<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
Author: George Karachalias &lt;george.karachalias@cs.kuleuven.be&gt;

Pattern Matching Coverage Checking.
-}</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE CPP            #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE GADTs          #-}</span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE TupleSections  #-}</span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# LANGUAGE ViewPatterns   #-}</span><span>
</span><span id="line-11"></span><span class="hs-pragma">{-# LANGUAGE MultiWayIf     #-}</span><span>
</span><span id="line-12"></span><span class="hs-pragma">{-# LANGUAGE LambdaCase     #-}</span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.HsToCore.PmCheck</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-15"></span><span>        </span><span class="hs-comment">-- Checking and printing</span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkSingle"><span class="hs-identifier">checkSingle</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkMatches"><span class="hs-identifier">checkMatches</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkGuardMatches"><span class="hs-identifier">checkGuardMatches</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#isMatchContextPmChecked"><span class="hs-identifier">isMatchContextPmChecked</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span>        </span><span class="hs-comment">-- See Note [Type and Term Equality Propagation]</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#addTyCsDs"><span class="hs-identifier">addTyCsDs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#addScrutTmCs"><span class="hs-identifier">addScrutTmCs</span></a></span><span>
</span><span id="line-21"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html"><span class="hs-identifier">GHC.HsToCore.PmCheck.Types</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Oracle.html"><span class="hs-identifier">GHC.HsToCore.PmCheck.Oracle</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Ppr.html"><span class="hs-identifier">GHC.HsToCore.PmCheck.Ppr</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#Origin"><span class="hs-identifier">Origin</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#isGenerated"><span class="hs-identifier">isGenerated</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.html"><span class="hs-identifier">GHC.Core</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier">CoreExpr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#Expr"><span class="hs-identifier">Expr</span></a></span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier">Var</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Core.html#App"><span class="hs-identifier">App</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.FastString.html#unpackFS"><span class="hs-identifier">unpackFS</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#lengthFS"><span class="hs-identifier">lengthFS</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Zonk.html"><span class="hs-identifier">GHC.Tc.Utils.Zonk</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.Zonk.html#shortCutLit"><span class="hs-identifier">shortCutLit</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html"><span class="hs-identifier">GHC.Core.ConLike</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Family.html"><span class="hs-identifier">GHC.Tc.Instance.Family</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html"><span class="hs-identifier">GHC.Builtin.Types</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier">EvVar</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html"><span class="hs-identifier">GHC.Core.Coercion</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html"><span class="hs-identifier">GHC.Tc.Types.Evidence</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#HsWrapper"><span class="hs-identifier">HsWrapper</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#isIdHsWrapper"><span class="hs-identifier">isIdHsWrapper</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#evVarPred"><span class="hs-identifier">evVarPred</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.HsToCore.Expr.html"><span class="hs-identifier">GHC.HsToCore.Expr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Expr.html#dsExpr"><span class="hs-identifier">dsExpr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Expr.html#dsLExpr"><span class="hs-identifier">dsLExpr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Expr.html#dsSyntaxExpr"><span class="hs-identifier">dsSyntaxExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.HsToCore.Binds.html"><span class="hs-identifier">GHC.HsToCore.Binds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Binds.html#dsHsWrapper"><span class="hs-identifier">dsHsWrapper</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html"><span class="hs-identifier">GHC.HsToCore.Utils</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier">selectMatchVar</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.Match.Literal.html"><span class="hs-identifier">GHC.HsToCore.Match.Literal</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Match.Literal.html#dsLit"><span class="hs-identifier">dsLit</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.Match.Literal.html#dsOverLit"><span class="hs-identifier">dsOverLit</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html"><span class="hs-identifier">GHC.HsToCore.Monad</span></a></span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html"><span class="hs-identifier">GHC.Data.Bag</span></a></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.IOEnv.html"><span class="hs-identifier">GHC.Data.IOEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.IOEnv.html#unsafeInterleaveM"><span class="hs-identifier">unsafeInterleaveM</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.OrdList.html"><span class="hs-identifier">GHC.Data.OrdList</span></a></span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html"><span class="hs-identifier">GHC.Core.TyCo.Rep</span></a></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.HsToCore.Utils.html"><span class="hs-identifier">GHC.HsToCore.Utils</span></a></span><span>       </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier">isTrueLHsExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html"><span class="hs-identifier">GHC.Data.Maybe</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.LanguageExtensions.html#"><span class="hs-identifier">GHC.LanguageExtensions</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">LangExt</span></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Monad.html"><span class="hs-identifier">GHC.Utils.Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Monad.html#concatMapM"><span class="hs-identifier">concatMapM</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier">when</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#forM_"><span class="hs-identifier">forM_</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#zipWithM"><span class="hs-identifier">zipWithM</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-66"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.OldList.html#elemIndex"><span class="hs-identifier">elemIndex</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-67"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Data.Semigroup.html#"><span class="hs-identifier">Data.Semigroup</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Semi</span></span><span>
</span><span id="line-68"></span><span>
</span><span id="line-69"></span><span class="hs-comment">{-
This module checks pattern matches for:
\begin{enumerate}
  \item Equations that are redundant
  \item Equations with inaccessible right-hand-side
  \item Exhaustiveness
\end{enumerate}

The algorithm is based on the paper:

  &quot;GADTs Meet Their Match:
     Pattern-matching Warnings That Account for GADTs, Guards, and Laziness&quot;

    https://www.microsoft.com/en-us/research/wp-content/uploads/2016/08/gadtpm-acm.pdf

%************************************************************************
%*                                                                      *
                     Pattern Match Check Types
%*                                                                      *
%************************************************************************
-}</span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span class="hs-comment">-- | A very simple language for pattern guards. Let bindings, bang patterns,</span><span>
</span><span id="line-92"></span><span class="hs-comment">-- and matching variables against flat constructor patterns.</span><span>
</span><span id="line-93"></span><span class="hs-keyword">data</span><span> </span><span id="PmGrd"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmGrd"><span class="hs-identifier hs-var">PmGrd</span></a></span></span><span>
</span><span id="line-94"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- | @PmCon x K dicts args@ corresponds to a @K dicts args &lt;- x@ guard.</span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-comment">-- The @args@ are bound in this construct, the @x@ is just a use.</span><span>
</span><span id="line-96"></span><span>    </span><span class="hs-comment">-- For the arguments' meaning see 'GHC.Hs.Pat.ConPatOut'.</span><span>
</span><span id="line-97"></span><span>    </span><span id="PmCon"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmCon"><span class="hs-identifier hs-var">PmCon</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-98"></span><span>      </span><span id="pm_id"><span class="annot"><span class="annottext">PmGrd -&gt; Id
</span><a href="GHC.HsToCore.PmCheck.html#pm_id"><span class="hs-identifier hs-var hs-var">pm_id</span></a></span></span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-99"></span><span>      </span><span id="pm_con_con"><span class="annot"><span class="annottext">PmGrd -&gt; PmAltCon
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_con"><span class="hs-identifier hs-var hs-var">pm_con_con</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#PmAltCon"><span class="hs-identifier hs-type">PmAltCon</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-100"></span><span>      </span><span id="pm_con_tvs"><span class="annot"><span class="annottext">PmGrd -&gt; [Id]
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_tvs"><span class="hs-identifier hs-var hs-var">pm_con_tvs</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-101"></span><span>      </span><span id="pm_con_dicts"><span class="annot"><span class="annottext">PmGrd -&gt; [Id]
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_dicts"><span class="hs-identifier hs-var hs-var">pm_con_dicts</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-102"></span><span>      </span><span id="pm_con_args"><span class="annot"><span class="annottext">PmGrd -&gt; [Id]
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_args"><span class="hs-identifier hs-var hs-var">pm_con_args</span></a></span></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-103"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span>    </span><span class="hs-comment">-- | @PmBang x@ corresponds to a @seq x True@ guard.</span><span>
</span><span id="line-106"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="PmBang"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmBang"><span class="hs-identifier hs-var">PmBang</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-107"></span><span>      </span><span id="pm_id"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#pm_id"><span class="hs-identifier hs-var">pm_id</span></a></span></span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span>
</span><span id="line-108"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span>    </span><span class="hs-comment">-- | @PmLet x expr@ corresponds to a @let x = expr@ guard. This actually</span><span>
</span><span id="line-111"></span><span>    </span><span class="hs-comment">-- /binds/ @x@.</span><span>
</span><span id="line-112"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="PmLet"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmLet"><span class="hs-identifier hs-var">PmLet</span></a></span></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-113"></span><span>      </span><span id="pm_id"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#pm_id"><span class="hs-identifier hs-var">pm_id</span></a></span></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-114"></span><span>      </span><span id="_pm_let_expr"><span class="annot"><span class="annottext">PmGrd -&gt; CoreExpr
</span><a href="GHC.HsToCore.PmCheck.html#_pm_let_expr"><span class="hs-identifier hs-var hs-var">_pm_let_expr</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-115"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span class="hs-comment">-- | Should not be user-facing.</span><span>
</span><span id="line-118"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681145318"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmGrd"><span class="hs-identifier hs-type">PmGrd</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-119"></span><span>  </span><span id="local-6989586621681145308"><span class="annot"><span class="annottext">ppr :: PmGrd -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmCon"><span class="hs-identifier hs-type">PmCon</span></a></span><span> </span><span id="local-6989586621681145306"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145306"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681145305"><span class="annot"><span class="annottext">PmAltCon
</span><a href="#local-6989586621681145305"><span class="hs-identifier hs-var">alt</span></a></span></span><span> </span><span id="local-6989586621681145304"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145304"><span class="hs-identifier hs-var">_tvs</span></a></span></span><span> </span><span id="local-6989586621681145303"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145303"><span class="hs-identifier hs-var">_con_dicts</span></a></span></span><span> </span><span id="local-6989586621681145302"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145302"><span class="hs-identifier hs-var">con_args</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-120"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">PmAltCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">PmAltCon
</span><a href="#local-6989586621681145305"><span class="hs-identifier hs-var">alt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Id -&gt; SDoc) -&gt; [Id] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145302"><span class="hs-identifier hs-var">con_args</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&lt;-&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145306"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-121"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmBang"><span class="hs-identifier hs-type">PmBang</span></a></span><span> </span><span id="local-6989586621681145299"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145299"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'!'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145299"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-122"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmLet"><span class="hs-identifier hs-type">PmLet</span></a></span><span> </span><span id="local-6989586621681145296"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145296"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681145295"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681145295"><span class="hs-identifier hs-var">expr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;let&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145296"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;=&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681145295"><span class="hs-identifier hs-var">expr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-123"></span><span>
</span><span id="line-124"></span><span class="hs-keyword">type</span><span> </span><span id="GrdVec"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-var">GrdVec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmGrd"><span class="hs-identifier hs-type">PmGrd</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span class="hs-keyword">data</span><span> </span><span id="Precision"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Precision"><span class="hs-identifier hs-var">Precision</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Approximate"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Approximate"><span class="hs-identifier hs-var">Approximate</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="Precise"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Precise"><span class="hs-identifier hs-var">Precise</span></a></span></span><span>
</span><span id="line-127"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681145288"><span id="local-6989586621681145290"><span class="annot"><span class="annottext">Precision -&gt; Precision -&gt; Bool
(Precision -&gt; Precision -&gt; Bool)
-&gt; (Precision -&gt; Precision -&gt; Bool) -&gt; Eq Precision
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: Precision -&gt; Precision -&gt; Bool
$c/= :: Precision -&gt; Precision -&gt; Bool
== :: Precision -&gt; Precision -&gt; Bool
$c== :: Precision -&gt; Precision -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681145281"><span id="local-6989586621681145283"><span id="local-6989586621681145285"><span class="annot"><span class="annottext">Int -&gt; Precision -&gt; ShowS
[Precision] -&gt; ShowS
Precision -&gt; String
(Int -&gt; Precision -&gt; ShowS)
-&gt; (Precision -&gt; String)
-&gt; ([Precision] -&gt; ShowS)
-&gt; Show Precision
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [Precision] -&gt; ShowS
$cshowList :: [Precision] -&gt; ShowS
show :: Precision -&gt; String
$cshow :: Precision -&gt; String
showsPrec :: Int -&gt; Precision -&gt; ShowS
$cshowsPrec :: Int -&gt; Precision -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-128"></span><span>
</span><span id="line-129"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681145277"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Precision"><span class="hs-identifier hs-type">Precision</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-130"></span><span>  </span><span id="local-6989586621681145275"><span class="annot"><span class="annottext">ppr :: Precision -&gt; SDoc
</span><a href="#local-6989586621681145275"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">(String -&gt; SDoc) -&gt; (Precision -&gt; String) -&gt; Precision -&gt; SDoc
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Precision -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span>
</span><span id="line-131"></span><span>
</span><span id="line-132"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681145268"><span id="local-6989586621681145270"><span class="annot"><a href="../../base/src/GHC.Base.html#Semigroup"><span class="hs-identifier hs-type">Semi.Semigroup</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Precision"><span class="hs-identifier hs-type">Precision</span></a></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-133"></span><span>  </span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Precise"><span class="hs-identifier hs-var">Precise</span></a></span><span> </span><span id="local-6989586621681145266"><span class="annot"><span class="annottext">&lt;&gt; :: Precision -&gt; Precision -&gt; Precision
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;&gt;</span></a></span></span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Precise"><span class="hs-identifier hs-var">Precise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Precise"><span class="hs-identifier hs-var">Precise</span></a></span><span>
</span><span id="line-134"></span><span>  </span><span class="annot"><span class="annottext">Precision
</span><span class="hs-identifier">_</span></span><span>       </span><span class="annot"><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Precision
</span><span class="hs-identifier">_</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Approximate"><span class="hs-identifier hs-var">Approximate</span></a></span><span>
</span><span id="line-135"></span><span>
</span><span id="line-136"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681145260"><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Precision"><span class="hs-identifier hs-type">Precision</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-137"></span><span>  </span><span id="local-6989586621681145258"><span class="annot"><span class="annottext">mempty :: Precision
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var hs-var hs-var hs-var">mempty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Precise"><span class="hs-identifier hs-var">Precise</span></a></span><span>
</span><span id="line-138"></span><span>  </span><span id="local-6989586621681145256"><span class="annot"><span class="annottext">mappend :: Precision -&gt; Precision -&gt; Precision
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-identifier hs-var hs-var hs-var hs-var">mappend</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Precision -&gt; Precision -&gt; Precision
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">(Semi.&lt;&gt;)</span></a></span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span class="hs-comment">-- | Means by which we identify a RHS for later pretty-printing in a warning</span><span>
</span><span id="line-141"></span><span class="hs-comment">-- message. 'SDoc' for the equation to show, 'Located' for the location.</span><span>
</span><span id="line-142"></span><span class="hs-keyword">type</span><span> </span><span id="RhsInfo"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#RhsInfo"><span class="hs-identifier hs-var">RhsInfo</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span class="hs-comment">-- | A representation of the desugaring to 'PmGrd's of all clauses of a</span><span>
</span><span id="line-145"></span><span class="hs-comment">-- function definition/pattern match/etc.</span><span>
</span><span id="line-146"></span><span class="hs-keyword">data</span><span> </span><span id="GrdTree"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-var">GrdTree</span></a></span></span><span>
</span><span id="line-147"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Rhs"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Rhs"><span class="hs-identifier hs-var">Rhs</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#RhsInfo"><span class="hs-identifier hs-type">RhsInfo</span></a></span><span>
</span><span id="line-148"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Guard"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Guard"><span class="hs-identifier hs-var">Guard</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmGrd"><span class="hs-identifier hs-type">PmGrd</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-type">GrdTree</span></a></span><span>
</span><span id="line-149"></span><span>  </span><span class="hs-comment">-- ^ @Guard grd t@ will try to match @grd@ and on success continue to match</span><span>
</span><span id="line-150"></span><span>  </span><span class="hs-comment">-- @t@. Falls through if either match fails. Models left-to-right semantics</span><span>
</span><span id="line-151"></span><span>  </span><span class="hs-comment">-- of pattern matching.</span><span>
</span><span id="line-152"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Sequence"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Sequence"><span class="hs-identifier hs-var">Sequence</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-type">GrdTree</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-type">GrdTree</span></a></span><span>
</span><span id="line-153"></span><span>  </span><span class="hs-comment">-- ^ @Sequence l r@ first matches against @l@, and then matches all</span><span>
</span><span id="line-154"></span><span>  </span><span class="hs-comment">-- fallen-through values against @r@. Models top-to-bottom semantics of</span><span>
</span><span id="line-155"></span><span>  </span><span class="hs-comment">-- pattern matching.</span><span>
</span><span id="line-156"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Empty"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span></span><span>
</span><span id="line-157"></span><span>  </span><span class="hs-comment">-- ^ A @GrdTree@ that always fails. Most useful for</span><span>
</span><span id="line-158"></span><span>  </span><span class="hs-comment">-- Note [Checking EmptyCase]. A neutral element to 'Sequence'.</span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span class="hs-comment">-- | The digest of 'checkGrdTree', representing the annotated pattern-match</span><span>
</span><span id="line-161"></span><span class="hs-comment">-- tree. 'redundantAndInaccessibleRhss' can figure out redundant and proper</span><span>
</span><span id="line-162"></span><span class="hs-comment">-- inaccessible RHSs from this.</span><span>
</span><span id="line-163"></span><span class="hs-keyword">data</span><span> </span><span id="AnnotatedTree"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AnnotatedTree"><span class="hs-identifier hs-var">AnnotatedTree</span></a></span></span><span>
</span><span id="line-164"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="AccessibleRhs"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AccessibleRhs"><span class="hs-identifier hs-var">AccessibleRhs</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#RhsInfo"><span class="hs-identifier hs-type">RhsInfo</span></a></span><span>
</span><span id="line-165"></span><span>  </span><span class="hs-comment">-- ^ A RHS deemed accessible. The 'Deltas' is the (non-empty) set of covered</span><span>
</span><span id="line-166"></span><span>  </span><span class="hs-comment">-- values.</span><span>
</span><span id="line-167"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="InaccessibleRhs"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#InaccessibleRhs"><span class="hs-identifier hs-var">InaccessibleRhs</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#RhsInfo"><span class="hs-identifier hs-type">RhsInfo</span></a></span><span>
</span><span id="line-168"></span><span>  </span><span class="hs-comment">-- ^ A RHS deemed inaccessible; it covers no value.</span><span>
</span><span id="line-169"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="MayDiverge"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#MayDiverge"><span class="hs-identifier hs-var">MayDiverge</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AnnotatedTree"><span class="hs-identifier hs-type">AnnotatedTree</span></a></span><span>
</span><span id="line-170"></span><span>  </span><span class="hs-comment">-- ^ Asserts that the tree may force diverging values, so not all of its</span><span>
</span><span id="line-171"></span><span>  </span><span class="hs-comment">-- clauses can be redundant.</span><span>
</span><span id="line-172"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="SequenceAnn"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#SequenceAnn"><span class="hs-identifier hs-var">SequenceAnn</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AnnotatedTree"><span class="hs-identifier hs-type">AnnotatedTree</span></a></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AnnotatedTree"><span class="hs-identifier hs-type">AnnotatedTree</span></a></span><span>
</span><span id="line-173"></span><span>  </span><span class="hs-comment">-- ^ Mirrors 'Sequence' for preserving the skeleton of a 'GrdTree's.</span><span>
</span><span id="line-174"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="EmptyAnn"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#EmptyAnn"><span class="hs-identifier hs-var">EmptyAnn</span></a></span></span><span>
</span><span id="line-175"></span><span>  </span><span class="hs-comment">-- ^ Mirrors 'Empty' for preserving the skeleton of a 'GrdTree's.</span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#pprRhsInfo"><span class="hs-identifier hs-type">pprRhsInfo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#RhsInfo"><span class="hs-identifier hs-type">RhsInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-178"></span><span id="pprRhsInfo"><span class="annot"><span class="annottext">pprRhsInfo :: RhsInfo -&gt; SDoc
</span><a href="GHC.HsToCore.PmCheck.html#pprRhsInfo"><span class="hs-identifier hs-var hs-var">pprRhsInfo</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#RealSrcSpan"><span class="hs-identifier hs-type">RealSrcSpan</span></a></span><span> </span><span id="local-6989586621681145243"><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621681145243"><span class="hs-identifier hs-var">rss</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe BufSpan
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RealSrcSpan -&gt; Int
</span><a href="GHC.Types.SrcLoc.html#srcSpanStartLine"><span class="hs-identifier hs-var">srcSpanStartLine</span></a></span><span> </span><span class="annot"><span class="annottext">RealSrcSpan
</span><a href="#local-6989586621681145243"><span class="hs-identifier hs-var">rss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-179"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#pprRhsInfo"><span class="hs-identifier hs-var">pprRhsInfo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681145241"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681145241"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681145241"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681145238"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-type">GrdTree</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-182"></span><span>  </span><span id="local-6989586621681145235"><span class="annot"><span class="annottext">ppr :: GrdTree -&gt; SDoc
</span><a href="#local-6989586621681145235"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Rhs"><span class="hs-identifier hs-type">Rhs</span></a></span><span> </span><span id="local-6989586621681145234"><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681145234"><span class="hs-identifier hs-var">info</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-&gt;&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo -&gt; SDoc
</span><a href="GHC.HsToCore.PmCheck.html#pprRhsInfo"><span class="hs-identifier hs-var">pprRhsInfo</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681145234"><span class="hs-identifier hs-var">info</span></a></span><span>
</span><span id="line-183"></span><span>  </span><span class="hs-comment">-- Format guards as &quot;| True &lt;- x, let x = 42, !z&quot;</span><span>
</span><span id="line-184"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span id="local-6989586621681145232"><span class="annot"><span class="annottext">g :: GrdTree
</span><a href="#local-6989586621681145232"><span class="hs-identifier hs-var">g</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Guard"><span class="hs-identifier hs-type">Guard</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#fsep"><span class="hs-identifier hs-var">fsep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; [SDoc]
</span><a href="#local-6989586621681145230"><span class="hs-identifier hs-var">prefix</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(PmGrd -&gt; SDoc) -&gt; [PmGrd] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681145229"><span class="hs-identifier hs-var">grds</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145228"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-185"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-186"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621681145228"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145228"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681145229"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681145229"><span class="hs-identifier hs-var">grds</span></a></span></span><span class="hs-special">)</span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; (GrdTree, [PmGrd])
</span><a href="#local-6989586621681145227"><span class="hs-identifier hs-var">collect_grds</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145232"><span class="hs-identifier hs-var">g</span></a></span><span>
</span><span id="line-187"></span><span>      </span><span id="local-6989586621681145227"><span class="annot"><span class="annottext">collect_grds :: GrdTree -&gt; (GrdTree, [PmGrd])
</span><a href="#local-6989586621681145227"><span class="hs-identifier hs-var hs-var">collect_grds</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Guard"><span class="hs-identifier hs-type">Guard</span></a></span><span> </span><span id="local-6989586621681145224"><span class="annot"><span class="annottext">PmGrd
</span><a href="#local-6989586621681145224"><span class="hs-identifier hs-var">grd</span></a></span></span><span> </span><span id="local-6989586621681145223"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145223"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PmGrd
</span><a href="#local-6989586621681145224"><span class="hs-identifier hs-var">grd</span></a></span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; [PmGrd] -&gt; [PmGrd]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([PmGrd] -&gt; [PmGrd]) -&gt; (GrdTree, [PmGrd]) -&gt; (GrdTree, [PmGrd])
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; (GrdTree, [PmGrd])
</span><a href="#local-6989586621681145227"><span class="hs-identifier hs-var">collect_grds</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145223"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-188"></span><span>      </span><span class="annot"><a href="#local-6989586621681145227"><span class="hs-identifier hs-var">collect_grds</span></a></span><span> </span><span id="local-6989586621681145221"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145221"><span class="hs-identifier hs-var">t</span></a></span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145221"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-189"></span><span>      </span><span id="local-6989586621681145230"><span class="annot"><span class="annottext">prefix :: [SDoc] -&gt; [SDoc]
</span><a href="#local-6989586621681145230"><span class="hs-identifier hs-var hs-var">prefix</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-190"></span><span>      </span><span class="annot"><a href="#local-6989586621681145230"><span class="hs-identifier hs-var">prefix</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681145220"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681145220"><span class="hs-identifier hs-var">s</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681145219"><span class="annot"><span class="annottext">[SDoc]
</span><a href="#local-6989586621681145219"><span class="hs-identifier hs-var">sdocs</span></a></span></span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'|'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681145220"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; [SDoc] -&gt; [SDoc]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; [SDoc] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#comma"><span class="hs-identifier hs-var">comma</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[SDoc]
</span><a href="#local-6989586621681145219"><span class="hs-identifier hs-var">sdocs</span></a></span><span>
</span><span id="line-191"></span><span>  </span><span class="hs-comment">-- Format nested Sequences in blocks &quot;{ grds1; grds2; ... }&quot;</span><span>
</span><span id="line-192"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span id="local-6989586621681145217"><span class="annot"><span class="annottext">t :: GrdTree
</span><a href="#local-6989586621681145217"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Sequence"><span class="hs-identifier hs-type">Sequence</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#space"><span class="hs-identifier hs-var">space</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#fsep"><span class="hs-identifier hs-var">fsep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; [SDoc] -&gt; [SDoc]
</span><a href="GHC.Utils.Outputable.html#punctuate"><span class="hs-identifier hs-var">punctuate</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#semi"><span class="hs-identifier hs-var">semi</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GrdTree -&gt; [SDoc]
</span><a href="#local-6989586621681145212"><span class="hs-identifier hs-var">collect_seqs</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145217"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#space"><span class="hs-identifier hs-var">space</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-193"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-194"></span><span>      </span><span id="local-6989586621681145212"><span class="annot"><span class="annottext">collect_seqs :: GrdTree -&gt; [SDoc]
</span><a href="#local-6989586621681145212"><span class="hs-identifier hs-var hs-var">collect_seqs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Sequence"><span class="hs-identifier hs-type">Sequence</span></a></span><span> </span><span id="local-6989586621681145210"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145210"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681145209"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145209"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; [SDoc]
</span><a href="#local-6989586621681145212"><span class="hs-identifier hs-var">collect_seqs</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145210"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; [SDoc] -&gt; [SDoc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; [SDoc]
</span><a href="#local-6989586621681145212"><span class="hs-identifier hs-var">collect_seqs</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145209"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-195"></span><span>      </span><span class="annot"><a href="#local-6989586621681145212"><span class="hs-identifier hs-var">collect_seqs</span></a></span><span> </span><span id="local-6989586621681145208"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145208"><span class="hs-identifier hs-var">t</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">GrdTree -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145208"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-196"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&lt;empty case&gt;&quot;</span></span><span>
</span><span id="line-197"></span><span>
</span><span id="line-198"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681145205"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AnnotatedTree"><span class="hs-identifier hs-type">AnnotatedTree</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-199"></span><span>  </span><span id="local-6989586621681145203"><span class="annot"><span class="annottext">ppr :: AnnotatedTree -&gt; SDoc
</span><a href="#local-6989586621681145203"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AccessibleRhs"><span class="hs-identifier hs-type">AccessibleRhs</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681145202"><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681145202"><span class="hs-identifier hs-var">info</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RhsInfo -&gt; SDoc
</span><a href="GHC.HsToCore.PmCheck.html#pprRhsInfo"><span class="hs-identifier hs-var">pprRhsInfo</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681145202"><span class="hs-identifier hs-var">info</span></a></span><span>
</span><span id="line-200"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#InaccessibleRhs"><span class="hs-identifier hs-type">InaccessibleRhs</span></a></span><span> </span><span id="local-6989586621681145201"><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681145201"><span class="hs-identifier hs-var">info</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;inaccessible&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo -&gt; SDoc
</span><a href="GHC.HsToCore.PmCheck.html#pprRhsInfo"><span class="hs-identifier hs-var">pprRhsInfo</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681145201"><span class="hs-identifier hs-var">info</span></a></span><span>
</span><span id="line-201"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#MayDiverge"><span class="hs-identifier hs-type">MayDiverge</span></a></span><span> </span><span id="local-6989586621681145200"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145200"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;div&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145200"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-202"></span><span>    </span><span class="hs-comment">-- Format nested Sequences in blocks &quot;{ grds1; grds2; ... }&quot;</span><span>
</span><span id="line-203"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span id="local-6989586621681145199"><span class="annot"><span class="annottext">t :: AnnotatedTree
</span><a href="#local-6989586621681145199"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#SequenceAnn"><span class="hs-identifier hs-type">SequenceAnn</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#space"><span class="hs-identifier hs-var">space</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#fsep"><span class="hs-identifier hs-var">fsep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; [SDoc] -&gt; [SDoc]
</span><a href="GHC.Utils.Outputable.html#punctuate"><span class="hs-identifier hs-var">punctuate</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#semi"><span class="hs-identifier hs-var">semi</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">AnnotatedTree -&gt; [SDoc]
</span><a href="#local-6989586621681145198"><span class="hs-identifier hs-var">collect_seqs</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145199"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#space"><span class="hs-identifier hs-var">space</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-204"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-205"></span><span>      </span><span id="local-6989586621681145198"><span class="annot"><span class="annottext">collect_seqs :: AnnotatedTree -&gt; [SDoc]
</span><a href="#local-6989586621681145198"><span class="hs-identifier hs-var hs-var">collect_seqs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#SequenceAnn"><span class="hs-identifier hs-type">SequenceAnn</span></a></span><span> </span><span id="local-6989586621681145196"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145196"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681145195"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145195"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; [SDoc]
</span><a href="#local-6989586621681145198"><span class="hs-identifier hs-var">collect_seqs</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145196"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; [SDoc] -&gt; [SDoc]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; [SDoc]
</span><a href="#local-6989586621681145198"><span class="hs-identifier hs-var">collect_seqs</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145195"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-206"></span><span>      </span><span class="annot"><a href="#local-6989586621681145198"><span class="hs-identifier hs-var">collect_seqs</span></a></span><span> </span><span id="local-6989586621681145194"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145194"><span class="hs-identifier hs-var">t</span></a></span></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">AnnotatedTree -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145194"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-207"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#EmptyAnn"><span class="hs-identifier hs-var">EmptyAnn</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&lt;empty case&gt;&quot;</span></span><span>
</span><span id="line-208"></span><span>
</span><span id="line-209"></span><span class="hs-comment">-- | Lift 'addPmCts' over 'Deltas'.</span><span>
</span><span id="line-210"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#addPmCtsDeltas"><span class="hs-identifier hs-type">addPmCtsDeltas</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Oracle.html#PmCts"><span class="hs-identifier hs-type">PmCts</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span>
</span><span id="line-211"></span><span id="addPmCtsDeltas"><span class="annot"><span class="annottext">addPmCtsDeltas :: Deltas -&gt; PmCts -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtsDeltas"><span class="hs-identifier hs-var hs-var">addPmCtsDeltas</span></a></span></span><span> </span><span id="local-6989586621681145192"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145192"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span id="local-6989586621681145191"><span class="annot"><span class="annottext">PmCts
</span><a href="#local-6989586621681145191"><span class="hs-identifier hs-var">cts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Delta -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Maybe Delta))
-&gt; Deltas -&gt; DsM Deltas
forall (m :: * -&gt; *).
Monad m =&gt;
(Delta -&gt; m (Maybe Delta)) -&gt; Deltas -&gt; m Deltas
</span><a href="GHC.HsToCore.PmCheck.Types.html#liftDeltasM"><span class="hs-identifier hs-var">liftDeltasM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681145189"><span class="annot"><span class="annottext">Delta
</span><a href="#local-6989586621681145189"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Delta -&gt; PmCts -&gt; IOEnv (Env DsGblEnv DsLclEnv) (Maybe Delta)
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#addPmCts"><span class="hs-identifier hs-var">addPmCts</span></a></span><span> </span><span class="annot"><span class="annottext">Delta
</span><a href="#local-6989586621681145189"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">PmCts
</span><a href="#local-6989586621681145191"><span class="hs-identifier hs-var">cts</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145192"><span class="hs-identifier hs-var">deltas</span></a></span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span class="hs-comment">-- | 'addPmCtsDeltas' a single 'PmCt'.</span><span>
</span><span id="line-214"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#addPmCtDeltas"><span class="hs-identifier hs-type">addPmCtDeltas</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Oracle.html#PmCt"><span class="hs-identifier hs-type">PmCt</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span>
</span><span id="line-215"></span><span id="addPmCtDeltas"><span class="annot"><span class="annottext">addPmCtDeltas :: Deltas -&gt; PmCt -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtDeltas"><span class="hs-identifier hs-var hs-var">addPmCtDeltas</span></a></span></span><span> </span><span id="local-6989586621681145186"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145186"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span id="local-6989586621681145185"><span class="annot"><span class="annottext">PmCt
</span><a href="#local-6989586621681145185"><span class="hs-identifier hs-var">ct</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; PmCts -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtsDeltas"><span class="hs-identifier hs-var">addPmCtsDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145186"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PmCt -&gt; PmCts
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="annot"><span class="annottext">PmCt
</span><a href="#local-6989586621681145185"><span class="hs-identifier hs-var">ct</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-216"></span><span>
</span><span id="line-217"></span><span class="hs-comment">-- | Test if any of the 'Delta's is inhabited. Currently this is pure, because</span><span>
</span><span id="line-218"></span><span class="hs-comment">-- we preserve the invariant that there are no uninhabited 'Delta's. But that</span><span>
</span><span id="line-219"></span><span class="hs-comment">-- could change in the future, for example by implementing this function in</span><span>
</span><span id="line-220"></span><span class="hs-comment">-- terms of @notNull &lt;$&gt; provideEvidence 1 ds@.</span><span>
</span><span id="line-221"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#isInhabited"><span class="hs-identifier hs-type">isInhabited</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-222"></span><span id="isInhabited"><span class="annot"><span class="annottext">isInhabited :: Deltas -&gt; DsM Bool
</span><a href="GHC.HsToCore.PmCheck.html#isInhabited"><span class="hs-identifier hs-var hs-var">isInhabited</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#MkDeltas"><span class="hs-identifier hs-type">MkDeltas</span></a></span><span> </span><span id="local-6989586621681145181"><span class="annot"><span class="annottext">Bag Delta
</span><a href="#local-6989586621681145181"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; DsM Bool
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag Delta -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Delta
</span><a href="#local-6989586621681145181"><span class="hs-identifier hs-var">ds</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span class="hs-comment">-- | Pattern-match check result</span><span>
</span><span id="line-225"></span><span class="hs-keyword">data</span><span> </span><span id="CheckResult"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-var">CheckResult</span></a></span></span><span>
</span><span id="line-226"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="CheckResult"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-var">CheckResult</span></a></span></span><span>
</span><span id="line-227"></span><span>  </span><span class="hs-special">{</span><span> </span><span id="cr_clauses"><span class="annot"><span class="annottext">CheckResult -&gt; AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#cr_clauses"><span class="hs-identifier hs-var hs-var">cr_clauses</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AnnotatedTree"><span class="hs-identifier hs-type">AnnotatedTree</span></a></span><span>
</span><span id="line-228"></span><span>  </span><span class="hs-comment">-- ^ Captures redundancy info for each clause in the original program.</span><span>
</span><span id="line-229"></span><span>  </span><span class="hs-comment">--   (for -Woverlapping-patterns)</span><span>
</span><span id="line-230"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="cr_uncov"><span class="annot"><span class="annottext">CheckResult -&gt; Deltas
</span><a href="GHC.HsToCore.PmCheck.html#cr_uncov"><span class="hs-identifier hs-var hs-var">cr_uncov</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span>
</span><span id="line-231"></span><span>  </span><span class="hs-comment">-- ^ The set of uncovered values falling out at the bottom.</span><span>
</span><span id="line-232"></span><span>  </span><span class="hs-comment">--   (for -Wincomplete-patterns)</span><span>
</span><span id="line-233"></span><span>  </span><span class="hs-special">,</span><span> </span><span id="cr_approx"><span class="annot"><span class="annottext">CheckResult -&gt; Precision
</span><a href="GHC.HsToCore.PmCheck.html#cr_approx"><span class="hs-identifier hs-var hs-var">cr_approx</span></a></span></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Precision"><span class="hs-identifier hs-type">Precision</span></a></span><span>
</span><span id="line-234"></span><span>  </span><span class="hs-comment">-- ^ A flag saying whether we ran into the 'maxPmCheckModels' limit for the</span><span>
</span><span id="line-235"></span><span>  </span><span class="hs-comment">--   purpose of suggesting to crank it up in the warning message</span><span>
</span><span id="line-236"></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-237"></span><span>
</span><span id="line-238"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681145172"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-239"></span><span>  </span><span id="local-6989586621681145169"><span class="annot"><span class="annottext">ppr :: CheckResult -&gt; SDoc
</span><a href="#local-6989586621681145169"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span> </span><span id="local-6989586621681145168"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145168"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621681145167"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145167"><span class="hs-identifier hs-var">unc</span></a></span></span><span> </span><span id="local-6989586621681145166"><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681145166"><span class="hs-identifier hs-var">pc</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-240"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CheckResult&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Precision -&gt; SDoc
</span><a href="#local-6989586621681145165"><span class="hs-identifier hs-var">ppr_precision</span></a></span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681145166"><span class="hs-identifier hs-var">pc</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#fsep"><span class="hs-identifier hs-var">fsep</span></a></span><span>
</span><span id="line-241"></span><span>        </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; AnnotatedTree -&gt; SDoc
forall {a}. Outputable a =&gt; String -&gt; a -&gt; SDoc
</span><a href="#local-6989586621681145164"><span class="hs-identifier hs-var">field</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;clauses&quot;</span></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145168"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#comma"><span class="hs-identifier hs-var">comma</span></a></span><span>
</span><span id="line-242"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; Deltas -&gt; SDoc
forall {a}. Outputable a =&gt; String -&gt; a -&gt; SDoc
</span><a href="#local-6989586621681145164"><span class="hs-identifier hs-var">field</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;uncov&quot;</span></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145167"><span class="hs-identifier hs-var">unc</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-243"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-244"></span><span>      </span><span id="local-6989586621681145165"><span class="annot"><span class="annottext">ppr_precision :: Precision -&gt; SDoc
</span><a href="#local-6989586621681145165"><span class="hs-identifier hs-var hs-var">ppr_precision</span></a></span></span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Precise"><span class="hs-identifier hs-var">Precise</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-245"></span><span>      </span><span class="annot"><a href="#local-6989586621681145165"><span class="hs-identifier hs-var">ppr_precision</span></a></span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Approximate"><span class="hs-identifier hs-var">Approximate</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(Approximate)&quot;</span></span><span>
</span><span id="line-246"></span><span>      </span><span id="local-6989586621681145164"><span class="annot"><span class="annottext">field :: String -&gt; a -&gt; SDoc
</span><a href="#local-6989586621681145164"><span class="hs-identifier hs-var hs-var">field</span></a></span></span><span> </span><span id="local-6989586621681145160"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681145160"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span id="local-6989586621681145159"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681145159"><span class="hs-identifier hs-var">value</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681145160"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#equals"><span class="hs-identifier hs-var">equals</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681145159"><span class="hs-identifier hs-var">value</span></a></span><span>
</span><span id="line-247"></span><span>
</span><span id="line-248"></span><span class="hs-comment">{-
%************************************************************************
%*                                                                      *
       Entry points to the checker: checkSingle and checkMatches
%*                                                                      *
%************************************************************************
-}</span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span class="hs-comment">-- | Check a single pattern binding (let) for exhaustiveness.</span><span>
</span><span id="line-257"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkSingle"><span class="hs-identifier hs-type">checkSingle</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-type">DsMatchContext</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-258"></span><span id="checkSingle"><span class="annot"><span class="annottext">checkSingle :: DynFlags
-&gt; DsMatchContext -&gt; Id -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM ()
</span><a href="GHC.HsToCore.PmCheck.html#checkSingle"><span class="hs-identifier hs-var hs-var">checkSingle</span></a></span></span><span> </span><span id="local-6989586621681145156"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681145156"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681145155"><span class="annot"><span class="annottext">ctxt :: DsMatchContext
</span><a href="#local-6989586621681145155"><span class="hs-identifier hs-var">ctxt</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-type">DsMatchContext</span></a></span><span> </span><span id="local-6989586621681145153"><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681145153"><span class="hs-identifier hs-var">kind</span></a></span></span><span> </span><span id="local-6989586621681145152"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681145152"><span class="hs-identifier hs-var">locn</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681145151"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145151"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span id="local-6989586621681145150"><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145150"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-259"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#tracePm"><span class="hs-identifier hs-var">tracePm</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;checkSingle&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">DsMatchContext -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DsMatchContext
</span><a href="#local-6989586621681145155"><span class="hs-identifier hs-var">ctxt</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145151"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145150"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-260"></span><span>  </span><span class="hs-comment">-- We only ever need to run this in a context where we need exhaustivity</span><span>
</span><span id="line-261"></span><span>  </span><span class="hs-comment">-- warnings (so not in pattern guards or comprehensions, for example, because</span><span>
</span><span id="line-262"></span><span>  </span><span class="hs-comment">-- they are perfectly fine to fail).</span><span>
</span><span id="line-263"></span><span>  </span><span class="hs-comment">-- Omitting checking this flag emits redundancy warnings twice in obscure</span><span>
</span><span id="line-264"></span><span>  </span><span class="hs-comment">-- cases like #17646.</span><span>
</span><span id="line-265"></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; DsM () -&gt; DsM ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; HsMatchContext GhcRn -&gt; Bool
forall id. DynFlags -&gt; HsMatchContext id -&gt; Bool
</span><a href="GHC.HsToCore.PmCheck.html#exhaustive"><span class="hs-identifier hs-var">exhaustive</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681145156"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681145153"><span class="hs-identifier hs-var">kind</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(DsM () -&gt; DsM ()) -&gt; DsM () -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-266"></span><span>    </span><span class="hs-comment">-- TODO: This could probably call checkMatches, like checkGuardMatches.</span><span>
</span><span id="line-267"></span><span>    </span><span id="local-6989586621681145146"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145146"><span class="hs-identifier hs-var">missing</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM Deltas
</span><a href="GHC.HsToCore.Monad.html#getPmDeltas"><span class="hs-identifier hs-var">getPmDeltas</span></a></span><span>
</span><span id="line-268"></span><span>    </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#tracePm"><span class="hs-identifier hs-var">tracePm</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;checkSingle: missing&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Deltas -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145146"><span class="hs-identifier hs-var">missing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-269"></span><span>    </span><span id="local-6989586621681145144"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145144"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM FamInstEnvs
</span><a href="GHC.HsToCore.Monad.html#dsGetFamInstEnvs"><span class="hs-identifier hs-var">dsGetFamInstEnvs</span></a></span><span>
</span><span id="line-270"></span><span>    </span><span id="local-6989586621681145142"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145142"><span class="hs-identifier hs-var">grd_tree</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RhsInfo -&gt; [PmGrd] -&gt; GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#mkGrdTreeRhs"><span class="hs-identifier hs-var">mkGrdTreeRhs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; SDoc -&gt; RhsInfo
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681145152"><span class="hs-identifier hs-var">locn</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; RhsInfo) -&gt; SDoc -&gt; RhsInfo
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145150"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([PmGrd] -&gt; GrdTree)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) GrdTree
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; Pat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translatePat"><span class="hs-identifier hs-var">translatePat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145144"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145151"><span class="hs-identifier hs-var">var</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145150"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-271"></span><span>    </span><span id="local-6989586621681145139"><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681145139"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; Deltas -&gt; DsM CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#checkGrdTree"><span class="hs-identifier hs-var">checkGrdTree</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145142"><span class="hs-identifier hs-var">grd_tree</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145146"><span class="hs-identifier hs-var">missing</span></a></span><span>
</span><span id="line-272"></span><span>    </span><span class="annot"><span class="annottext">DynFlags -&gt; DsMatchContext -&gt; [Id] -&gt; CheckResult -&gt; DsM ()
</span><a href="GHC.HsToCore.PmCheck.html#dsPmWarn"><span class="hs-identifier hs-var">dsPmWarn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681145156"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DsMatchContext
</span><a href="#local-6989586621681145155"><span class="hs-identifier hs-var">ctxt</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145151"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681145139"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span class="hs-comment">-- | Exhaustive for guard matches, is used for guards in pattern bindings and</span><span>
</span><span id="line-275"></span><span class="hs-comment">-- in @MultiIf@ expressions. Returns the 'Deltas' covered by the RHSs.</span><span>
</span><span id="line-276"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkGuardMatches"><span class="hs-identifier hs-type">checkGuardMatches</span></a></span><span>
</span><span id="line-277"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#HsMatchContext"><span class="hs-identifier hs-type">HsMatchContext</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span>         </span><span class="hs-comment">-- ^ Match context, for warning messages</span><span>
</span><span id="line-278"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#GRHSs"><span class="hs-identifier hs-type">GRHSs</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- ^ The GRHSs to check</span><span>
</span><span id="line-279"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span class="hs-special">]</span><span>                 </span><span class="hs-comment">-- ^ Covered 'Deltas' for each RHS, for long</span><span>
</span><span id="line-280"></span><span>                                  </span><span class="hs-comment">--   distance info</span><span>
</span><span id="line-281"></span><span id="checkGuardMatches"><span class="annot"><span class="annottext">checkGuardMatches :: HsMatchContext GhcRn
-&gt; GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
-&gt; DsM [Deltas]
</span><a href="GHC.HsToCore.PmCheck.html#checkGuardMatches"><span class="hs-identifier hs-var hs-var">checkGuardMatches</span></a></span></span><span> </span><span id="local-6989586621681145136"><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681145136"><span class="hs-identifier hs-var">hs_ctx</span></a></span></span><span> </span><span id="local-6989586621681145135"><span class="annot"><span class="annottext">guards :: GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681145135"><span class="hs-identifier hs-var">guards</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#GRHSs"><span class="hs-identifier hs-type">GRHSs</span></a></span><span> </span><span class="annot"><span class="annottext">XCGRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681145133"><span class="annot"><span class="annottext">[LGRHS (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681145133"><span class="hs-identifier hs-var">grhss</span></a></span></span><span> </span><span class="annot"><span class="annottext">LHsLocalBinds (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-282"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681145132"><span class="annot"><span class="annottext">combinedLoc :: SrcSpan
</span><a href="#local-6989586621681145132"><span class="hs-identifier hs-var hs-var">combinedLoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(SrcSpan -&gt; SrcSpan -&gt; SrcSpan) -&gt; [SrcSpan] -&gt; SrcSpan
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; a -&gt; a) -&gt; t a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#foldl1"><span class="hs-identifier hs-var">foldl1</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#combineSrcSpans"><span class="hs-identifier hs-var">combineSrcSpans</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LGRHS (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
 -&gt; SrcSpan)
-&gt; [LGRHS (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
-&gt; [SrcSpan]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LGRHS (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
-&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">[LGRHS (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681145133"><span class="hs-identifier hs-var">grhss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-283"></span><span>        </span><span id="local-6989586621681145128"><span class="annot"><span class="annottext">dsMatchContext :: DsMatchContext
</span><a href="#local-6989586621681145128"><span class="hs-identifier hs-var hs-var">dsMatchContext</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn -&gt; SrcSpan -&gt; DsMatchContext
</span><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-var">DsMatchContext</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681145136"><span class="hs-identifier hs-var">hs_ctx</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681145132"><span class="hs-identifier hs-var">combinedLoc</span></a></span><span>
</span><span id="line-284"></span><span>        </span><span id="local-6989586621681145127"><span class="annot"><span class="annottext">match :: LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681145127"><span class="hs-identifier hs-var hs-var">match</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; Match (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
-&gt; LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681145132"><span class="hs-identifier hs-var">combinedLoc</span></a></span><span> </span><span class="annot"><span class="annottext">(Match (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
 -&gt; LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
-&gt; Match (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
-&gt; LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-285"></span><span>                  </span><span class="annot"><span class="annottext">Match :: forall p body.
XCMatch p body
-&gt; HsMatchContext (NoGhcTc p)
-&gt; [LPat p]
-&gt; GRHSs p body
-&gt; Match p body
</span><a href="GHC.Hs.Expr.html#Match"><span class="hs-identifier hs-type">Match</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">m_ext :: XCMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Hs.Expr.html#m_ext"><span class="hs-identifier hs-var">m_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NoExtField
XCMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span>
</span><span id="line-286"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">m_ctxt :: HsMatchContext (NoGhcTc (GhcPass 'Typechecked))
</span><a href="GHC.Hs.Expr.html#m_ctxt"><span class="hs-identifier hs-var">m_ctxt</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
HsMatchContext (NoGhcTc (GhcPass 'Typechecked))
</span><a href="#local-6989586621681145136"><span class="hs-identifier hs-var">hs_ctx</span></a></span><span>
</span><span id="line-287"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">m_pats :: [LPat (GhcPass 'Typechecked)]
</span><a href="GHC.Hs.Expr.html#m_pats"><span class="hs-identifier hs-var">m_pats</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-288"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">m_grhss :: GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Hs.Expr.html#m_grhss"><span class="hs-identifier hs-var">m_grhss</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681145135"><span class="hs-identifier hs-var">guards</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-289"></span><span>    </span><span class="annot"><span class="annottext">DsMatchContext
-&gt; [Id]
-&gt; [LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
-&gt; DsM [Deltas]
</span><a href="GHC.HsToCore.PmCheck.html#checkMatches"><span class="hs-identifier hs-var">checkMatches</span></a></span><span> </span><span class="annot"><span class="annottext">DsMatchContext
</span><a href="#local-6989586621681145128"><span class="hs-identifier hs-var">dsMatchContext</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681145127"><span class="hs-identifier hs-var">match</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-290"></span><span>
</span><span id="line-291"></span><span class="hs-comment">-- | Check a list of syntactic /match/es (part of case, functions, etc.), each</span><span>
</span><span id="line-292"></span><span class="hs-comment">-- with a /pat/ and one or more /grhss/:</span><span>
</span><span id="line-293"></span><span class="hs-comment">--</span><span>
</span><span id="line-294"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-295"></span><span class="hs-comment">--   f x y | x == y    = 1   -- match on x and y with two guarded RHSs</span><span>
</span><span id="line-296"></span><span class="hs-comment">--         | otherwise = 2</span><span>
</span><span id="line-297"></span><span class="hs-comment">--   f _ _             = 3   -- clause with a single, un-guarded RHS</span><span>
</span><span id="line-298"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-299"></span><span class="hs-comment">--</span><span>
</span><span id="line-300"></span><span class="hs-comment">-- Returns one 'Deltas' for each GRHS, representing its covered values, or the</span><span>
</span><span id="line-301"></span><span class="hs-comment">-- incoming uncovered 'Deltas' (from 'getPmDeltas') if the GRHS is inaccessible.</span><span>
</span><span id="line-302"></span><span class="hs-comment">-- Since there is at least one /grhs/ per /match/, the list of 'Deltas' is at</span><span>
</span><span id="line-303"></span><span class="hs-comment">-- least as long as the list of matches.</span><span>
</span><span id="line-304"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkMatches"><span class="hs-identifier hs-type">checkMatches</span></a></span><span>
</span><span id="line-305"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-type">DsMatchContext</span></a></span><span>                  </span><span class="hs-comment">-- ^ Match context, for warnings messages</span><span>
</span><span id="line-306"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>                            </span><span class="hs-comment">-- ^ Match variables, i.e. x and y above</span><span>
</span><span id="line-307"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Expr.html#LMatch"><span class="hs-identifier hs-type">LMatch</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- ^ List of matches</span><span>
</span><span id="line-308"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span class="hs-special">]</span><span>                    </span><span class="hs-comment">-- ^ One covered 'Deltas' per RHS, for long</span><span>
</span><span id="line-309"></span><span>                                     </span><span class="hs-comment">--   distance info.</span><span>
</span><span id="line-310"></span><span id="checkMatches"><span class="annot"><span class="annottext">checkMatches :: DsMatchContext
-&gt; [Id]
-&gt; [LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
-&gt; DsM [Deltas]
</span><a href="GHC.HsToCore.PmCheck.html#checkMatches"><span class="hs-identifier hs-var hs-var">checkMatches</span></a></span></span><span> </span><span id="local-6989586621681145120"><span class="annot"><span class="annottext">DsMatchContext
</span><a href="#local-6989586621681145120"><span class="hs-identifier hs-var">ctxt</span></a></span></span><span> </span><span id="local-6989586621681145119"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145119"><span class="hs-identifier hs-var">vars</span></a></span></span><span> </span><span id="local-6989586621681145118"><span class="annot"><span class="annottext">[LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681145118"><span class="hs-identifier hs-var">matches</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-311"></span><span>  </span><span id="local-6989586621681145117"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681145117"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-312"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#tracePm"><span class="hs-identifier hs-var">tracePm</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;checkMatches&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">DsMatchContext -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DsMatchContext
</span><a href="#local-6989586621681145120"><span class="hs-identifier hs-var">ctxt</span></a></span><span>
</span><span id="line-313"></span><span>                               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145119"><span class="hs-identifier hs-var">vars</span></a></span><span>
</span><span id="line-314"></span><span>                               </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Matches:&quot;</span></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-315"></span><span>                               </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span>
</span><span id="line-316"></span><span>                               </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
 -&gt; SDoc)
-&gt; [LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
-&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
-&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681145118"><span class="hs-identifier hs-var">matches</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-317"></span><span>
</span><span id="line-318"></span><span>  </span><span id="local-6989586621681145114"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145114"><span class="hs-identifier hs-var">init_deltas</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM Deltas
</span><a href="GHC.HsToCore.Monad.html#getPmDeltas"><span class="hs-identifier hs-var">getPmDeltas</span></a></span><span>
</span><span id="line-319"></span><span>  </span><span id="local-6989586621681145113"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145113"><span class="hs-identifier hs-var">missing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681145118"><span class="hs-identifier hs-var">matches</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-320"></span><span>    </span><span class="hs-comment">-- This must be an -XEmptyCase. See Note [Checking EmptyCase]</span><span>
</span><span id="line-321"></span><span>    </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681145112"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145112"><span class="hs-identifier hs-var">var</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145119"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; PmCt -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtDeltas"><span class="hs-identifier hs-var">addPmCtDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145114"><span class="hs-identifier hs-var">init_deltas</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; PmCt
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#PmNotBotCt"><span class="hs-identifier hs-var">PmNotBotCt</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145112"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-322"></span><span>    </span><span class="annot"><span class="annottext">[LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
</span><span class="hs-identifier">_</span></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; DsM Deltas
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145114"><span class="hs-identifier hs-var">init_deltas</span></a></span><span>
</span><span id="line-323"></span><span>  </span><span id="local-6989586621681145110"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145110"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM FamInstEnvs
</span><a href="GHC.HsToCore.Monad.html#dsGetFamInstEnvs"><span class="hs-identifier hs-var">dsGetFamInstEnvs</span></a></span><span>
</span><span id="line-324"></span><span>  </span><span id="local-6989586621681145109"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145109"><span class="hs-identifier hs-var">grd_tree</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[PmGrd] -&gt; [GrdTree] -&gt; GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#mkGrdTreeMany"><span class="hs-identifier hs-var">mkGrdTreeMany</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">([GrdTree] -&gt; GrdTree)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [GrdTree]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) GrdTree
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) GrdTree)
-&gt; [LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [GrdTree]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; [Id]
-&gt; LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
-&gt; IOEnv (Env DsGblEnv DsLclEnv) GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#translateMatch"><span class="hs-identifier hs-var">translateMatch</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145110"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145119"><span class="hs-identifier hs-var">vars</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681145118"><span class="hs-identifier hs-var">matches</span></a></span><span>
</span><span id="line-325"></span><span>  </span><span id="local-6989586621681145105"><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681145105"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; Deltas -&gt; DsM CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#checkGrdTree"><span class="hs-identifier hs-var">checkGrdTree</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681145109"><span class="hs-identifier hs-var">grd_tree</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145113"><span class="hs-identifier hs-var">missing</span></a></span><span>
</span><span id="line-326"></span><span>
</span><span id="line-327"></span><span>  </span><span class="annot"><span class="annottext">DynFlags -&gt; DsMatchContext -&gt; [Id] -&gt; CheckResult -&gt; DsM ()
</span><a href="GHC.HsToCore.PmCheck.html#dsPmWarn"><span class="hs-identifier hs-var">dsPmWarn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681145117"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DsMatchContext
</span><a href="#local-6989586621681145120"><span class="hs-identifier hs-var">ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145119"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681145105"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-328"></span><span>
</span><span id="line-329"></span><span>  </span><span class="annot"><span class="annottext">[Deltas] -&gt; DsM [Deltas]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Deltas -&gt; AnnotatedTree -&gt; [Deltas]
</span><a href="GHC.HsToCore.PmCheck.html#extractRhsDeltas"><span class="hs-identifier hs-var">extractRhsDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145114"><span class="hs-identifier hs-var">init_deltas</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CheckResult -&gt; AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#cr_clauses"><span class="hs-identifier hs-var hs-var">cr_clauses</span></a></span><span> </span><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681145105"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-330"></span><span>
</span><span id="line-331"></span><span class="hs-comment">-- | Extract the 'Deltas' reaching the RHSs of the 'AnnotatedTree'.</span><span>
</span><span id="line-332"></span><span class="hs-comment">-- For 'AccessibleRhs's, this is stored in the tree node, whereas</span><span>
</span><span id="line-333"></span><span class="hs-comment">-- 'InaccessibleRhs's fall back to the supplied original 'Deltas'.</span><span>
</span><span id="line-334"></span><span class="hs-comment">-- See @Note [Recovering from unsatisfiable pattern-matching constraints]@.</span><span>
</span><span id="line-335"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#extractRhsDeltas"><span class="hs-identifier hs-type">extractRhsDeltas</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AnnotatedTree"><span class="hs-identifier hs-type">AnnotatedTree</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-336"></span><span id="extractRhsDeltas"><span class="annot"><span class="annottext">extractRhsDeltas :: Deltas -&gt; AnnotatedTree -&gt; [Deltas]
</span><a href="GHC.HsToCore.PmCheck.html#extractRhsDeltas"><span class="hs-identifier hs-var hs-var">extractRhsDeltas</span></a></span></span><span> </span><span id="local-6989586621681145103"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145103"><span class="hs-identifier hs-var">orig_deltas</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OrdList Deltas -&gt; [Deltas]
forall a. OrdList a -&gt; [a]
</span><a href="GHC.Data.OrdList.html#fromOL"><span class="hs-identifier hs-var">fromOL</span></a></span><span> </span><span class="annot"><span class="annottext">(OrdList Deltas -&gt; [Deltas])
-&gt; (AnnotatedTree -&gt; OrdList Deltas) -&gt; AnnotatedTree -&gt; [Deltas]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; OrdList Deltas
</span><a href="#local-6989586621681145101"><span class="hs-identifier hs-var">go</span></a></span><span>
</span><span id="line-337"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-338"></span><span>    </span><span id="local-6989586621681145101"><span class="annot"><span class="annottext">go :: AnnotatedTree -&gt; OrdList Deltas
</span><a href="#local-6989586621681145101"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AccessibleRhs"><span class="hs-identifier hs-type">AccessibleRhs</span></a></span><span> </span><span id="local-6989586621681145100"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145100"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span class="annot"><span class="annottext">RhsInfo
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; OrdList Deltas
forall a. a -&gt; OrdList a
</span><a href="GHC.Data.OrdList.html#unitOL"><span class="hs-identifier hs-var">unitOL</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145100"><span class="hs-identifier hs-var">deltas</span></a></span><span>
</span><span id="line-339"></span><span>    </span><span class="annot"><a href="#local-6989586621681145101"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#InaccessibleRhs"><span class="hs-identifier hs-type">InaccessibleRhs</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; OrdList Deltas
forall a. a -&gt; OrdList a
</span><a href="GHC.Data.OrdList.html#unitOL"><span class="hs-identifier hs-var">unitOL</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681145103"><span class="hs-identifier hs-var">orig_deltas</span></a></span><span>
</span><span id="line-340"></span><span>    </span><span class="annot"><a href="#local-6989586621681145101"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#MayDiverge"><span class="hs-identifier hs-type">MayDiverge</span></a></span><span> </span><span id="local-6989586621681145098"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145098"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; OrdList Deltas
</span><a href="#local-6989586621681145101"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145098"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-341"></span><span>    </span><span class="annot"><a href="#local-6989586621681145101"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#SequenceAnn"><span class="hs-identifier hs-type">SequenceAnn</span></a></span><span> </span><span id="local-6989586621681145097"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145097"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681145096"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145096"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; OrdList Deltas
</span><a href="#local-6989586621681145101"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145097"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">OrdList Deltas -&gt; OrdList Deltas -&gt; OrdList Deltas
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">Semi.&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; OrdList Deltas
</span><a href="#local-6989586621681145101"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681145096"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-342"></span><span>    </span><span class="annot"><a href="#local-6989586621681145101"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#EmptyAnn"><span class="hs-identifier hs-var">EmptyAnn</span></a></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OrdList Deltas
forall a. OrdList a
</span><a href="GHC.Data.OrdList.html#nilOL"><span class="hs-identifier hs-var">nilOL</span></a></span><span>
</span><span id="line-343"></span><span>
</span><span id="line-344"></span><span class="hs-comment">{- Note [Checking EmptyCase]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-XEmptyCase is useful for matching on empty data types like 'Void'. For example,
the following is a complete match:

    f :: Void -&gt; ()
    f x = case x of {}

Really, -XEmptyCase is the only way to write a program that at the same time is
safe (@f _ = error &quot;boom&quot;@ is not because of &#8869;), doesn't trigger a warning
(@f !_ = error &quot;inaccessible&quot; has inaccessible RHS) and doesn't turn an
exception into divergence (@f x = f x@).

Semantically, unlike every other case expression, -XEmptyCase is strict in its
match var x, which rules out &#8869; as an inhabitant. So we add x /~ &#8869; to the
initial Delta and check if there are any values left to match on.
-}</span><span>
</span><span id="line-361"></span><span>
</span><span id="line-362"></span><span class="hs-comment">{-
%************************************************************************
%*                                                                      *
              Transform source syntax to *our* syntax
%*                                                                      *
%************************************************************************
-}</span><span>
</span><span id="line-369"></span><span>
</span><span id="line-370"></span><span class="hs-comment">-- -----------------------------------------------------------------------</span><span>
</span><span id="line-371"></span><span class="hs-comment">-- * Utilities</span><span>
</span><span id="line-372"></span><span>
</span><span id="line-373"></span><span class="hs-comment">-- | Smart constructor that eliminates trivial lets</span><span>
</span><span id="line-374"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#mkPmLetVar"><span class="hs-identifier hs-type">mkPmLetVar</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span>
</span><span id="line-375"></span><span id="mkPmLetVar"><span class="annot"><span class="annottext">mkPmLetVar :: Id -&gt; Id -&gt; [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#mkPmLetVar"><span class="hs-identifier hs-var hs-var">mkPmLetVar</span></a></span></span><span> </span><span id="local-6989586621681145093"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145093"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681145092"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145092"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145093"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Id -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145092"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-376"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#mkPmLetVar"><span class="hs-identifier hs-var">mkPmLetVar</span></a></span><span> </span><span id="local-6989586621681145091"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145091"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681145090"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145090"><span class="hs-identifier hs-var">y</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmLet"><span class="hs-identifier hs-var">PmLet</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145091"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145090"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-377"></span><span>
</span><span id="line-378"></span><span class="hs-comment">-- | ADT constructor pattern =&gt; no existentials, no local constraints</span><span>
</span><span id="line-379"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#vanillaConGrd"><span class="hs-identifier hs-type">vanillaConGrd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmGrd"><span class="hs-identifier hs-type">PmGrd</span></a></span><span>
</span><span id="line-380"></span><span id="vanillaConGrd"><span class="annot"><span class="annottext">vanillaConGrd :: Id -&gt; DataCon -&gt; [Id] -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#vanillaConGrd"><span class="hs-identifier hs-var hs-var">vanillaConGrd</span></a></span></span><span> </span><span id="local-6989586621681145088"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145088"><span class="hs-identifier hs-var">scrut</span></a></span></span><span> </span><span id="local-6989586621681145087"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681145087"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621681145086"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145086"><span class="hs-identifier hs-var">arg_ids</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-381"></span><span>  </span><span class="annot"><span class="annottext">PmCon :: Id -&gt; PmAltCon -&gt; [Id] -&gt; [Id] -&gt; [Id] -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmCon"><span class="hs-identifier hs-type">PmCon</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pm_id :: Id
</span><a href="GHC.HsToCore.PmCheck.html#pm_id"><span class="hs-identifier hs-var">pm_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145088"><span class="hs-identifier hs-var">scrut</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pm_con_con :: PmAltCon
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_con"><span class="hs-identifier hs-var">pm_con_con</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; PmAltCon
</span><a href="GHC.HsToCore.PmCheck.Types.html#PmAltConLike"><span class="hs-identifier hs-var">PmAltConLike</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; ConLike
</span><a href="GHC.Core.ConLike.html#RealDataCon"><span class="hs-identifier hs-var">RealDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681145087"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-382"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pm_con_tvs :: [Id]
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_tvs"><span class="hs-identifier hs-var">pm_con_tvs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pm_con_dicts :: [Id]
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_dicts"><span class="hs-identifier hs-var">pm_con_dicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pm_con_args :: [Id]
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_args"><span class="hs-identifier hs-var">pm_con_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145086"><span class="hs-identifier hs-var">arg_ids</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-383"></span><span>
</span><span id="line-384"></span><span class="hs-comment">-- | Creates a 'GrdVec' refining a match var of list type to a list,</span><span>
</span><span id="line-385"></span><span class="hs-comment">-- where list fields are matched against the incoming tagged 'GrdVec's.</span><span>
</span><span id="line-386"></span><span class="hs-comment">-- For example:</span><span>
</span><span id="line-387"></span><span class="hs-comment">--   @mkListGrds &quot;a&quot; &quot;[(x, True &lt;- x),(y, !y)]&quot;@</span><span>
</span><span id="line-388"></span><span class="hs-comment">-- to</span><span>
</span><span id="line-389"></span><span class="hs-comment">--   @&quot;[(x:b) &lt;- a, True &lt;- x, (y:c) &lt;- b, seq y True, [] &lt;- c]&quot;@</span><span>
</span><span id="line-390"></span><span class="hs-comment">-- where @b@ and @c@ are freshly allocated in @mkListGrds@ and @a@ is the match</span><span>
</span><span id="line-391"></span><span class="hs-comment">-- variable.</span><span>
</span><span id="line-392"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#mkListGrds"><span class="hs-identifier hs-type">mkListGrds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span>
</span><span id="line-393"></span><span class="hs-comment">-- See Note [Order of guards matter] for why we need to intertwine guards</span><span>
</span><span id="line-394"></span><span class="hs-comment">-- on list elements.</span><span>
</span><span id="line-395"></span><span id="mkListGrds"><span class="annot"><span class="annottext">mkListGrds :: Id -&gt; [(Id, [PmGrd])] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#mkListGrds"><span class="hs-identifier hs-var hs-var">mkListGrds</span></a></span></span><span> </span><span id="local-6989586621681145082"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145082"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id -&gt; DataCon -&gt; [Id] -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#vanillaConGrd"><span class="hs-identifier hs-var">vanillaConGrd</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145082"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#nilDataCon"><span class="hs-identifier hs-var">nilDataCon</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-396"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#mkListGrds"><span class="hs-identifier hs-var">mkListGrds</span></a></span><span> </span><span id="local-6989586621681145080"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145080"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621681145079"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145079"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681145078"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681145078"><span class="hs-identifier hs-var">head_grds</span></a></span></span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681145077"><span class="annot"><span class="annottext">[(Id, [PmGrd])]
</span><a href="#local-6989586621681145077"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-397"></span><span>  </span><span id="local-6989586621681145076"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145076"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; DsM Id
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#mkPmId"><span class="hs-identifier hs-var">mkPmId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Type
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145080"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-398"></span><span>  </span><span id="local-6989586621681145073"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681145073"><span class="hs-identifier hs-var">tail_grds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Id -&gt; [(Id, [PmGrd])] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#mkListGrds"><span class="hs-identifier hs-var">mkListGrds</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145076"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, [PmGrd])]
</span><a href="#local-6989586621681145077"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-399"></span><span>  </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">([PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; [PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; DataCon -&gt; [Id] -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#vanillaConGrd"><span class="hs-identifier hs-var">vanillaConGrd</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145080"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#consDataCon"><span class="hs-identifier hs-var">consDataCon</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145079"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145076"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; [PmGrd] -&gt; [PmGrd]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681145078"><span class="hs-identifier hs-var">head_grds</span></a></span><span> </span><span class="annot"><span class="annottext">[PmGrd] -&gt; [PmGrd] -&gt; [PmGrd]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681145073"><span class="hs-identifier hs-var">tail_grds</span></a></span><span>
</span><span id="line-400"></span><span>
</span><span id="line-401"></span><span class="hs-comment">-- | Create a 'GrdVec' refining a match variable to a 'PmLit'.</span><span>
</span><span id="line-402"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#mkPmLitGrds"><span class="hs-identifier hs-type">mkPmLitGrds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#PmLit"><span class="hs-identifier hs-type">PmLit</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span>
</span><span id="line-403"></span><span id="mkPmLitGrds"><span class="annot"><span class="annottext">mkPmLitGrds :: Id -&gt; PmLit -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#mkPmLitGrds"><span class="hs-identifier hs-var hs-var">mkPmLitGrds</span></a></span></span><span> </span><span id="local-6989586621681145070"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145070"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#PmLit"><span class="hs-identifier hs-type">PmLit</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#PmLitString"><span class="hs-identifier hs-type">PmLitString</span></a></span><span> </span><span id="local-6989586621681145067"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681145067"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-404"></span><span>  </span><span class="hs-comment">-- We translate String literals to list literals for better overlap reasoning.</span><span>
</span><span id="line-405"></span><span>  </span><span class="hs-comment">-- It's a little unfortunate we do this here rather than in</span><span>
</span><span id="line-406"></span><span>  </span><span class="hs-comment">-- 'GHC.HsToCore.PmCheck.Oracle.trySolve' and</span><span>
</span><span id="line-407"></span><span>  </span><span class="hs-comment">-- 'GHC.HsToCore.PmCheck.Oracle.addRefutableAltCon', but it's so much simpler</span><span>
</span><span id="line-408"></span><span>  </span><span class="hs-comment">-- here. See Note [Representation of Strings in TmState] in</span><span>
</span><span id="line-409"></span><span>  </span><span class="hs-comment">-- GHC.HsToCore.PmCheck.Oracle</span><span>
</span><span id="line-410"></span><span>  </span><span id="local-6989586621681145066"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145066"><span class="hs-identifier hs-var">vars</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; DsM Id) -&gt; [Type] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [Id]
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; DsM Id
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#mkPmId"><span class="hs-identifier hs-var">mkPmId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; [Type] -&gt; [Type]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; Int
</span><a href="GHC.Data.FastString.html#lengthFS"><span class="hs-identifier hs-var">lengthFS</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681145067"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; [Type]
forall a. a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#repeat"><span class="hs-identifier hs-var">repeat</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#charTy"><span class="hs-identifier hs-var">charTy</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-411"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681145061"><span class="annot"><span class="annottext">mk_char_lit :: Id -&gt; Char -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="#local-6989586621681145061"><span class="hs-identifier hs-var hs-var">mk_char_lit</span></a></span></span><span> </span><span id="local-6989586621681145060"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145060"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span id="local-6989586621681145059"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621681145059"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; PmLit -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#mkPmLitGrds"><span class="hs-identifier hs-var">mkPmLitGrds</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145060"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; PmLitValue -&gt; PmLit
</span><a href="GHC.HsToCore.PmCheck.Types.html#PmLit"><span class="hs-identifier hs-var">PmLit</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#charTy"><span class="hs-identifier hs-var">charTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; PmLitValue
</span><a href="GHC.HsToCore.PmCheck.Types.html#PmLitChar"><span class="hs-identifier hs-var">PmLitChar</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621681145059"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-412"></span><span>  </span><span id="local-6989586621681145057"><span class="annot"><span class="annottext">[[PmGrd]]
</span><a href="#local-6989586621681145057"><span class="hs-identifier hs-var">char_grdss</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Id -&gt; Char -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; [Id] -&gt; String -&gt; IOEnv (Env DsGblEnv DsLclEnv) [[PmGrd]]
forall (m :: * -&gt; *) a b c.
Applicative m =&gt;
(a -&gt; b -&gt; m c) -&gt; [a] -&gt; [b] -&gt; m [c]
</span><a href="../../base/src/Control.Monad.html#zipWithM"><span class="hs-identifier hs-var">zipWithM</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Char -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="#local-6989586621681145061"><span class="hs-identifier hs-var">mk_char_lit</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145066"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; String
</span><a href="GHC.Data.FastString.html#unpackFS"><span class="hs-identifier hs-var">unpackFS</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681145067"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-413"></span><span>  </span><span class="annot"><span class="annottext">Id -&gt; [(Id, [PmGrd])] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#mkListGrds"><span class="hs-identifier hs-var">mkListGrds</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145070"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id] -&gt; [[PmGrd]] -&gt; [(Id, [PmGrd])]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681145066"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="annot"><span class="annottext">[[PmGrd]]
</span><a href="#local-6989586621681145057"><span class="hs-identifier hs-var">char_grdss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-414"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#mkPmLitGrds"><span class="hs-identifier hs-var">mkPmLitGrds</span></a></span><span> </span><span id="local-6989586621681145056"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145056"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681145055"><span class="annot"><span class="annottext">PmLit
</span><a href="#local-6989586621681145055"><span class="hs-identifier hs-var">lit</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-415"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681145054"><span class="annot"><span class="annottext">grd :: PmGrd
</span><a href="#local-6989586621681145054"><span class="hs-identifier hs-var hs-var">grd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PmCon :: Id -&gt; PmAltCon -&gt; [Id] -&gt; [Id] -&gt; [Id] -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmCon"><span class="hs-identifier hs-type">PmCon</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pm_id :: Id
</span><a href="GHC.HsToCore.PmCheck.html#pm_id"><span class="hs-identifier hs-var">pm_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145056"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-416"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pm_con_con :: PmAltCon
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_con"><span class="hs-identifier hs-var">pm_con_con</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PmLit -&gt; PmAltCon
</span><a href="GHC.HsToCore.PmCheck.Types.html#PmAltLit"><span class="hs-identifier hs-var">PmAltLit</span></a></span><span> </span><span class="annot"><span class="annottext">PmLit
</span><a href="#local-6989586621681145055"><span class="hs-identifier hs-var">lit</span></a></span><span>
</span><span id="line-417"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pm_con_tvs :: [Id]
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_tvs"><span class="hs-identifier hs-var">pm_con_tvs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-418"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pm_con_dicts :: [Id]
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_dicts"><span class="hs-identifier hs-var">pm_con_dicts</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-419"></span><span>                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pm_con_args :: [Id]
</span><a href="GHC.HsToCore.PmCheck.html#pm_con_args"><span class="hs-identifier hs-var">pm_con_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-420"></span><span>  </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">PmGrd
</span><a href="#local-6989586621681145054"><span class="hs-identifier hs-var">grd</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-421"></span><span>
</span><span id="line-422"></span><span class="hs-comment">-- -----------------------------------------------------------------------</span><span>
</span><span id="line-423"></span><span class="hs-comment">-- * Transform (Pat Id) into GrdVec</span><span>
</span><span id="line-424"></span><span>
</span><span id="line-425"></span><span class="hs-comment">-- | @translatePat _ x pat@ transforms @pat@ into a 'GrdVec', where</span><span>
</span><span id="line-426"></span><span class="hs-comment">-- the variable representing the match is @x@.</span><span>
</span><span id="line-427"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translatePat"><span class="hs-identifier hs-type">translatePat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span>
</span><span id="line-428"></span><span id="translatePat"><span class="annot"><span class="annottext">translatePat :: FamInstEnvs
-&gt; Id
-&gt; Pat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translatePat"><span class="hs-identifier hs-var hs-var">translatePat</span></a></span></span><span> </span><span id="local-6989586621681145052"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span id="local-6989586621681145051"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681145050"><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145050"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145050"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-429"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#WildPat"><span class="hs-identifier hs-type">WildPat</span></a></span><span>  </span><span id="local-6989586621681145048"><span class="annot"><span class="annottext">XWildPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145048"><span class="hs-identifier hs-var">_ty</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-430"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#VarPat"><span class="hs-identifier hs-type">VarPat</span></a></span><span> </span><span class="annot"><span class="annottext">XVarPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681145046"><span class="annot"><span class="annottext">Located (IdP (GhcPass 'Typechecked))
</span><a href="#local-6989586621681145046"><span class="hs-identifier hs-var">y</span></a></span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Id -&gt; [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#mkPmLetVar"><span class="hs-identifier hs-var">mkPmLetVar</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Id -&gt; Id
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Id
Located (IdP (GhcPass 'Typechecked))
</span><a href="#local-6989586621681145046"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-431"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#ParPat"><span class="hs-identifier hs-type">ParPat</span></a></span><span> </span><span class="annot"><span class="annottext">XParPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681145043"><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145043"><span class="hs-identifier hs-var">p</span></a></span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; LPat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateLPat"><span class="hs-identifier hs-var">translateLPat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145043"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-432"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#LazyPat"><span class="hs-identifier hs-type">LazyPat</span></a></span><span> </span><span class="annot"><span class="annottext">XLazyPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- like a wildcard</span><span>
</span><span id="line-433"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#BangPat"><span class="hs-identifier hs-type">BangPat</span></a></span><span> </span><span class="annot"><span class="annottext">XBangPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681145039"><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145039"><span class="hs-identifier hs-var">p</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-434"></span><span>    </span><span class="hs-comment">-- Add the bang in front of the list, because it will happen before any</span><span>
</span><span id="line-435"></span><span>    </span><span class="hs-comment">-- nested stuff.</span><span>
</span><span id="line-436"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmBang"><span class="hs-identifier hs-var">PmBang</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; [PmGrd] -&gt; [PmGrd]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([PmGrd] -&gt; [PmGrd])
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; LPat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateLPat"><span class="hs-identifier hs-var">translateLPat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145039"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-437"></span><span>
</span><span id="line-438"></span><span>  </span><span class="hs-comment">-- (x@pat)   ==&gt;   Translate pat with x as match var and handle impedance</span><span>
</span><span id="line-439"></span><span>  </span><span class="hs-comment">--                 mismatch with incoming match var</span><span>
</span><span id="line-440"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#AsPat"><span class="hs-identifier hs-type">AsPat</span></a></span><span> </span><span class="annot"><span class="annottext">XAsPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681145037"><span class="annot"><span class="annottext">IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145037"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681145036"><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145036"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; Id -&gt; [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#mkPmLetVar"><span class="hs-identifier hs-var">mkPmLetVar</span></a></span><span> </span><span class="annot"><span class="annottext">Id
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145037"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[PmGrd] -&gt; [PmGrd] -&gt; [PmGrd]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">([PmGrd] -&gt; [PmGrd])
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; LPat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateLPat"><span class="hs-identifier hs-var">translateLPat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145037"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145036"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-441"></span><span>
</span><span id="line-442"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#SigPat"><span class="hs-identifier hs-type">SigPat</span></a></span><span> </span><span class="annot"><span class="annottext">XSigPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681145034"><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145034"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621681145033"><span class="annot"><span class="annottext">HsPatSigType (NoGhcTc (GhcPass 'Typechecked))
</span><a href="#local-6989586621681145033"><span class="hs-identifier hs-var">_ty</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; LPat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateLPat"><span class="hs-identifier hs-var">translateLPat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145034"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-443"></span><span>
</span><span id="line-444"></span><span>  </span><span class="hs-comment">-- See Note [Translate CoPats]</span><span>
</span><span id="line-445"></span><span>  </span><span class="hs-comment">-- Generally the translation is</span><span>
</span><span id="line-446"></span><span>  </span><span class="hs-comment">-- pat |&gt; co   ===&gt;   let y = x |&gt; co, pat &lt;- y  where y is a match var of pat</span><span>
</span><span id="line-447"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#XPat"><span class="hs-identifier hs-type">XPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#CoPat"><span class="hs-identifier hs-type">CoPat</span></a></span><span> </span><span id="local-6989586621681145030"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681145030"><span class="hs-identifier hs-var">wrapper</span></a></span></span><span> </span><span id="local-6989586621681145029"><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145029"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621681145028"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681145028"><span class="hs-identifier hs-var">_ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-448"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; Bool
</span><a href="GHC.Tc.Types.Evidence.html#isIdHsWrapper"><span class="hs-identifier hs-var">isIdHsWrapper</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681145030"><span class="hs-identifier hs-var">wrapper</span></a></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; Pat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translatePat"><span class="hs-identifier hs-var">translatePat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145029"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-449"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html#WpCast"><span class="hs-identifier hs-type">WpCast</span></a></span><span> </span><span id="local-6989586621681145026"><span class="annot"><span class="annottext">TcCoercionR
</span><a href="#local-6989586621681145026"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span>  </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681145030"><span class="hs-identifier hs-var">wrapper</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcCoercionR -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflexiveCo"><span class="hs-identifier hs-var">isReflexiveCo</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercionR
</span><a href="#local-6989586621681145026"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; Pat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translatePat"><span class="hs-identifier hs-var">translatePat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145029"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-450"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-451"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621681145024"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145024"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681145023"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681145023"><span class="hs-identifier hs-var">grds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM (Id, [PmGrd])
</span><a href="GHC.HsToCore.PmCheck.html#translatePatV"><span class="hs-identifier hs-var">translatePatV</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145029"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-452"></span><span>        </span><span id="local-6989586621681145021"><span class="annot"><span class="annottext">CoreExpr -&gt; CoreExpr
</span><a href="#local-6989586621681145021"><span class="hs-identifier hs-var">wrap_rhs_y</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; DsM (CoreExpr -&gt; CoreExpr)
</span><a href="GHC.HsToCore.Binds.html#dsHsWrapper"><span class="hs-identifier hs-var">dsHsWrapper</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681145030"><span class="hs-identifier hs-var">wrapper</span></a></span><span>
</span><span id="line-453"></span><span>        </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmLet"><span class="hs-identifier hs-var">PmLet</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145024"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreExpr -&gt; CoreExpr
</span><a href="#local-6989586621681145021"><span class="hs-identifier hs-var">wrap_rhs_y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; [PmGrd] -&gt; [PmGrd]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681145023"><span class="hs-identifier hs-var">grds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-454"></span><span>
</span><span id="line-455"></span><span>  </span><span class="hs-comment">-- (n + k)  ===&gt;   let b = x &gt;= k, True &lt;- b, let n = x-k</span><span>
</span><span id="line-456"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#NPlusKPat"><span class="hs-identifier hs-type">NPlusKPat</span></a></span><span> </span><span id="local-6989586621681145019"><span class="annot"><span class="annottext">XNPlusKPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145019"><span class="hs-identifier hs-var">_pat_ty</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681145018"><span class="annot"><span class="annottext">IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145018"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681145017"><span class="annot"><span class="annottext">Located (HsOverLit (GhcPass 'Typechecked))
</span><a href="#local-6989586621681145017"><span class="hs-identifier hs-var">k1</span></a></span></span><span> </span><span id="local-6989586621681145016"><span class="annot"><span class="annottext">HsOverLit (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145016"><span class="hs-identifier hs-var">k2</span></a></span></span><span> </span><span id="local-6989586621681145015"><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145015"><span class="hs-identifier hs-var">ge</span></a></span></span><span> </span><span id="local-6989586621681145014"><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145014"><span class="hs-identifier hs-var">minus</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-457"></span><span>    </span><span id="local-6989586621681145013"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145013"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; DsM Id
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#mkPmId"><span class="hs-identifier hs-var">mkPmId</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#boolTy"><span class="hs-identifier hs-var">boolTy</span></a></span><span>
</span><span id="line-458"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681145011"><span class="annot"><span class="annottext">grd_b :: PmGrd
</span><a href="#local-6989586621681145011"><span class="hs-identifier hs-var hs-var">grd_b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; DataCon -&gt; [Id] -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#vanillaConGrd"><span class="hs-identifier hs-var">vanillaConGrd</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145013"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#trueDataCon"><span class="hs-identifier hs-var">trueDataCon</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-459"></span><span>    </span><span class="hs-special">[</span><span id="local-6989586621681145009"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681145009"><span class="hs-identifier hs-var">ke1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681145008"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681145008"><span class="hs-identifier hs-var">ke2</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(HsOverLit (GhcPass 'Typechecked)
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr)
-&gt; [HsOverLit (GhcPass 'Typechecked)]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [CoreExpr]
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="annot"><span class="annottext">HsOverLit (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
</span><a href="GHC.HsToCore.Match.Literal.html#dsOverLit"><span class="hs-identifier hs-var">dsOverLit</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Located (HsOverLit (GhcPass 'Typechecked))
-&gt; HsOverLit (GhcPass 'Typechecked)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located (HsOverLit (GhcPass 'Typechecked))
</span><a href="#local-6989586621681145017"><span class="hs-identifier hs-var">k1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HsOverLit (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145016"><span class="hs-identifier hs-var">k2</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-460"></span><span>    </span><span id="local-6989586621681145007"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681145007"><span class="hs-identifier hs-var">rhs_b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
-&gt; [CoreExpr] -&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
</span><a href="GHC.HsToCore.Expr.html#dsSyntaxExpr"><span class="hs-identifier hs-var">dsSyntaxExpr</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145015"><span class="hs-identifier hs-var">ge</span></a></span><span>    </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681145009"><span class="hs-identifier hs-var">ke1</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-461"></span><span>    </span><span id="local-6989586621681145006"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681145006"><span class="hs-identifier hs-var">rhs_n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
-&gt; [CoreExpr] -&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
</span><a href="GHC.HsToCore.Expr.html#dsSyntaxExpr"><span class="hs-identifier hs-var">dsSyntaxExpr</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145014"><span class="hs-identifier hs-var">minus</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681145008"><span class="hs-identifier hs-var">ke2</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-462"></span><span>    </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmLet"><span class="hs-identifier hs-var">PmLet</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145013"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681145007"><span class="hs-identifier hs-var">rhs_b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PmGrd
</span><a href="#local-6989586621681145011"><span class="hs-identifier hs-var">grd_b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmLet"><span class="hs-identifier hs-var">PmLet</span></a></span><span> </span><span class="annot"><span class="annottext">Id
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145018"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681145006"><span class="hs-identifier hs-var">rhs_n</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-463"></span><span>
</span><span id="line-464"></span><span>  </span><span class="hs-comment">-- (fun -&gt; pat)   ===&gt;   let y = fun x, pat &lt;- y where y is a match var of pat</span><span>
</span><span id="line-465"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#ViewPat"><span class="hs-identifier hs-type">ViewPat</span></a></span><span> </span><span id="local-6989586621681145004"><span class="annot"><span class="annottext">XViewPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145004"><span class="hs-identifier hs-var">_arg_ty</span></a></span></span><span> </span><span id="local-6989586621681145003"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145003"><span class="hs-identifier hs-var">lexpr</span></a></span></span><span> </span><span id="local-6989586621681145002"><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145002"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-466"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681145001"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145001"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681145000"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681145000"><span class="hs-identifier hs-var">grds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs -&gt; LPat (GhcPass 'Typechecked) -&gt; DsM (Id, [PmGrd])
</span><a href="GHC.HsToCore.PmCheck.html#translateLPatV"><span class="hs-identifier hs-var">translateLPatV</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145002"><span class="hs-identifier hs-var">pat</span></a></span><span>
</span><span id="line-467"></span><span>    </span><span id="local-6989586621681144998"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144998"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
</span><a href="GHC.HsToCore.Expr.html#dsLExpr"><span class="hs-identifier hs-var">dsLExpr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681145003"><span class="hs-identifier hs-var">lexpr</span></a></span><span>
</span><span id="line-468"></span><span>    </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">([PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; [PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmLet"><span class="hs-identifier hs-var">PmLet</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145001"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreExpr -&gt; CoreExpr -&gt; CoreExpr
forall b. Expr b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#App"><span class="hs-identifier hs-var">App</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144998"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; [PmGrd] -&gt; [PmGrd]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681145000"><span class="hs-identifier hs-var">grds</span></a></span><span>
</span><span id="line-469"></span><span>
</span><span id="line-470"></span><span>  </span><span class="hs-comment">-- list</span><span>
</span><span id="line-471"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#ListPat"><span class="hs-identifier hs-type">ListPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#ListPatTc"><span class="hs-identifier hs-type">ListPatTc</span></a></span><span> </span><span id="local-6989586621681144995"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681144995"><span class="hs-identifier hs-var">_elem_ty</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe (Type, SyntaxExpr (GhcPass 'Typechecked))
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144994"><span class="annot"><span class="annottext">[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144994"><span class="hs-identifier hs-var">ps</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-472"></span><span>    </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; [LPat (GhcPass 'Typechecked)]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateListPat"><span class="hs-identifier hs-var">translateListPat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144994"><span class="hs-identifier hs-var">ps</span></a></span><span>
</span><span id="line-473"></span><span>
</span><span id="line-474"></span><span>  </span><span class="hs-comment">-- overloaded list</span><span>
</span><span id="line-475"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#ListPat"><span class="hs-identifier hs-type">ListPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#ListPatTc"><span class="hs-identifier hs-type">ListPatTc</span></a></span><span> </span><span id="local-6989586621681144992"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681144992"><span class="hs-identifier hs-var">elem_ty</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681144991"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681144991"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144990"><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144990"><span class="hs-identifier hs-var">to_list</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144989"><span class="annot"><span class="annottext">[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144989"><span class="hs-identifier hs-var">pats</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-476"></span><span>    </span><span id="local-6989586621681144988"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144988"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-477"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe Type
</span><a href="GHC.Core.Type.html#splitListTyConApp_maybe"><span class="hs-identifier hs-var">splitListTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681144991"><span class="hs-identifier hs-var">pat_ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-478"></span><span>      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681144986"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681144986"><span class="hs-identifier hs-var">_e_ty</span></a></span></span><span>
</span><span id="line-479"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Extension -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#xopt"><span class="hs-identifier hs-var">xopt</span></a></span><span> </span><span class="annot"><span class="annottext">Extension
</span><a href="../../ghc-boot-th/src/GHC.LanguageExtensions.Type.html#RebindableSyntax"><span class="hs-identifier hs-var">LangExt.RebindableSyntax</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144988"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-480"></span><span>        </span><span class="hs-comment">-- Just translate it as a regular ListPat</span><span>
</span><span id="line-481"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; [LPat (GhcPass 'Typechecked)]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateListPat"><span class="hs-identifier hs-var">translateListPat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144989"><span class="hs-identifier hs-var">pats</span></a></span><span>
</span><span id="line-482"></span><span>      </span><span class="annot"><span class="annottext">Maybe Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-483"></span><span>        </span><span id="local-6989586621681144983"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144983"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; DsM Id
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#mkPmId"><span class="hs-identifier hs-var">mkPmId</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Type
</span><a href="GHC.Builtin.Types.html#mkListTy"><span class="hs-identifier hs-var">mkListTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681144992"><span class="hs-identifier hs-var">elem_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-484"></span><span>        </span><span id="local-6989586621681144981"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144981"><span class="hs-identifier hs-var">grds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; [LPat (GhcPass 'Typechecked)]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateListPat"><span class="hs-identifier hs-var">translateListPat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144983"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144989"><span class="hs-identifier hs-var">pats</span></a></span><span>
</span><span id="line-485"></span><span>        </span><span id="local-6989586621681144980"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144980"><span class="hs-identifier hs-var">rhs_y</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
-&gt; [CoreExpr] -&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
</span><a href="GHC.HsToCore.Expr.html#dsSyntaxExpr"><span class="hs-identifier hs-var">dsSyntaxExpr</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144990"><span class="hs-identifier hs-var">to_list</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr
forall b. Id -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-486"></span><span>        </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">([PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; [PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmLet"><span class="hs-identifier hs-var">PmLet</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144983"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144980"><span class="hs-identifier hs-var">rhs_y</span></a></span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; [PmGrd] -&gt; [PmGrd]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144981"><span class="hs-identifier hs-var">grds</span></a></span><span>
</span><span id="line-487"></span><span>
</span><span id="line-488"></span><span>    </span><span class="hs-comment">-- (a) In the presence of RebindableSyntax, we don't know anything about</span><span>
</span><span id="line-489"></span><span>    </span><span class="hs-comment">--     `toList`, we should treat `ListPat` as any other view pattern.</span><span>
</span><span id="line-490"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-491"></span><span>    </span><span class="hs-comment">-- (b) In the absence of RebindableSyntax,</span><span>
</span><span id="line-492"></span><span>    </span><span class="hs-comment">--     - If the pat_ty is `[a]`, then we treat the overloaded list pattern</span><span>
</span><span id="line-493"></span><span>    </span><span class="hs-comment">--       as ordinary list pattern. Although we can give an instance</span><span>
</span><span id="line-494"></span><span>    </span><span class="hs-comment">--       `IsList [Int]` (more specific than the default `IsList [a]`), in</span><span>
</span><span id="line-495"></span><span>    </span><span class="hs-comment">--       practice, we almost never do that. We assume the `to_list` is</span><span>
</span><span id="line-496"></span><span>    </span><span class="hs-comment">--       the `toList` from `instance IsList [a]`.</span><span>
</span><span id="line-497"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-498"></span><span>    </span><span class="hs-comment">--     - Otherwise, we treat the `ListPat` as ordinary view pattern.</span><span>
</span><span id="line-499"></span><span>    </span><span class="hs-comment">--</span><span>
</span><span id="line-500"></span><span>    </span><span class="hs-comment">-- See #14547, especially comment#9 and comment#10.</span><span>
</span><span id="line-501"></span><span>
</span><span id="line-502"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#ConPat"><span class="hs-identifier hs-type">ConPat</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pat_con :: forall p. Pat p -&gt; Located (ConLikeP p)
</span><a href="GHC.Hs.Pat.html#pat_con"><span class="hs-identifier hs-var">pat_con</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681144977"><span class="annot"><span class="annottext">ConLikeP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144977"><span class="hs-identifier hs-var">con</span></a></span></span><span>
</span><span id="line-503"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_args :: forall p. Pat p -&gt; HsConPatDetails p
</span><a href="GHC.Hs.Pat.html#pat_args"><span class="hs-identifier hs-var">pat_args</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681144975"><span class="annot"><span class="annottext">HsConPatDetails (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144975"><span class="hs-identifier hs-var">ps</span></a></span></span><span>
</span><span id="line-504"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_con_ext :: forall p. Pat p -&gt; XConPat p
</span><a href="GHC.Hs.Pat.html#pat_con_ext"><span class="hs-identifier hs-var">pat_con_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#ConPatTc"><span class="hs-identifier hs-type">ConPatTc</span></a></span><span>
</span><span id="line-505"></span><span>           </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cpt_arg_tys :: ConPatTc -&gt; [Type]
</span><a href="GHC.Hs.Pat.html#cpt_arg_tys"><span class="hs-identifier hs-var">cpt_arg_tys</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681144971"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681144971"><span class="hs-identifier hs-var">arg_tys</span></a></span></span><span>
</span><span id="line-506"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_tvs :: ConPatTc -&gt; [Id]
</span><a href="GHC.Hs.Pat.html#cpt_tvs"><span class="hs-identifier hs-var">cpt_tvs</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681144969"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144969"><span class="hs-identifier hs-var">ex_tvs</span></a></span></span><span>
</span><span id="line-507"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cpt_dicts :: ConPatTc -&gt; [Id]
</span><a href="GHC.Hs.Pat.html#cpt_dicts"><span class="hs-identifier hs-var">cpt_dicts</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681144967"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144967"><span class="hs-identifier hs-var">dicts</span></a></span></span><span>
</span><span id="line-508"></span><span>           </span><span class="hs-special">}</span><span>
</span><span id="line-509"></span><span>         </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-510"></span><span>    </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; ConLike
-&gt; [Type]
-&gt; [Id]
-&gt; [Id]
-&gt; HsConPatDetails (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateConPatOut"><span class="hs-identifier hs-var">translateConPatOut</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
ConLikeP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144977"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681144971"><span class="hs-identifier hs-var">arg_tys</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144969"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144967"><span class="hs-identifier hs-var">dicts</span></a></span><span> </span><span class="annot"><span class="annottext">HsConPatDetails (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144975"><span class="hs-identifier hs-var">ps</span></a></span><span>
</span><span id="line-511"></span><span>
</span><span id="line-512"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#NPat"><span class="hs-identifier hs-type">NPat</span></a></span><span> </span><span id="local-6989586621681144964"><span class="annot"><span class="annottext">XNPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144964"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681144963"><span class="annot"><span class="annottext">HsOverLit (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144963"><span class="hs-identifier hs-var">olit</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144962"><span class="annot"><span class="annottext">Maybe (SyntaxExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681144962"><span class="hs-identifier hs-var">mb_neg</span></a></span></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-513"></span><span>    </span><span class="hs-comment">-- See Note [Literal short cut] in &quot;GHC.HsToCore.Match.Literal&quot;</span><span>
</span><span id="line-514"></span><span>    </span><span class="hs-comment">-- We inline the Literal short cut for @ty@ here, because @ty@ is more</span><span>
</span><span id="line-515"></span><span>    </span><span class="hs-comment">-- precise than the field of OverLitTc, which is all that dsOverLit (which</span><span>
</span><span id="line-516"></span><span>    </span><span class="hs-comment">-- normally does the literal short cut) can look at. Also @ty@ matches the</span><span>
</span><span id="line-517"></span><span>    </span><span class="hs-comment">-- type of the scrutinee, so info on both pattern and scrutinee (for which</span><span>
</span><span id="line-518"></span><span>    </span><span class="hs-comment">-- short cutting in dsOverLit works properly) is overloaded iff either is.</span><span>
</span><span id="line-519"></span><span>    </span><span id="local-6989586621681144961"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144961"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-520"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144960"><span class="annot"><span class="annottext">platform :: Platform
</span><a href="#local-6989586621681144960"><span class="hs-identifier hs-var hs-var">platform</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144961"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-521"></span><span>    </span><span id="local-6989586621681144958"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144958"><span class="hs-identifier hs-var">core_expr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HsOverLit (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144963"><span class="hs-identifier hs-var">olit</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-522"></span><span>      </span><span class="annot"><a href="GHC.Hs.Lit.html#OverLit"><span class="hs-identifier hs-type">OverLit</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ol_val :: forall p. HsOverLit p -&gt; OverLitVal
</span><a href="GHC.Hs.Lit.html#ol_val"><span class="hs-identifier hs-var">ol_val</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681144955"><span class="annot"><span class="annottext">OverLitVal
</span><a href="#local-6989586621681144955"><span class="hs-identifier hs-var">val</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ol_ext :: forall p. HsOverLit p -&gt; XOverLit p
</span><a href="GHC.Hs.Lit.html#ol_ext"><span class="hs-identifier hs-var">ol_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Hs.Lit.html#OverLitTc"><span class="hs-identifier hs-type">OverLitTc</span></a></span><span> </span><span id="local-6989586621681144952"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144952"><span class="hs-identifier hs-var">rebindable</span></a></span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-523"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144952"><span class="hs-identifier hs-var">rebindable</span></a></span><span>
</span><span id="line-524"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681144951"><span class="annot"><span class="annottext">HsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144951"><span class="hs-identifier hs-var">expr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Platform
-&gt; OverLitVal -&gt; Type -&gt; Maybe (HsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Utils.Zonk.html#shortCutLit"><span class="hs-identifier hs-var">shortCutLit</span></a></span><span> </span><span class="annot"><span class="annottext">Platform
</span><a href="#local-6989586621681144960"><span class="hs-identifier hs-var">platform</span></a></span><span> </span><span class="annot"><span class="annottext">OverLitVal
</span><a href="#local-6989586621681144955"><span class="hs-identifier hs-var">val</span></a></span><span> </span><span class="annot"><span class="annottext">Type
XNPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144964"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-525"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HsExpr (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
</span><a href="GHC.HsToCore.Expr.html#dsExpr"><span class="hs-identifier hs-var">dsExpr</span></a></span><span> </span><span class="annot"><span class="annottext">HsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144951"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-526"></span><span>      </span><span class="annot"><span class="annottext">HsOverLit (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HsOverLit (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
</span><a href="GHC.HsToCore.Match.Literal.html#dsOverLit"><span class="hs-identifier hs-var">dsOverLit</span></a></span><span> </span><span class="annot"><span class="annottext">HsOverLit (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144963"><span class="hs-identifier hs-var">olit</span></a></span><span>
</span><span id="line-527"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144950"><span class="annot"><span class="annottext">lit :: PmLit
</span><a href="#local-6989586621681144950"><span class="hs-identifier hs-var hs-var">lit</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe PmLit -&gt; PmLit
forall a. HasCallStack =&gt; String -&gt; Maybe a -&gt; a
</span><a href="GHC.Data.Maybe.html#expectJust"><span class="hs-identifier hs-var">expectJust</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;failed to detect OverLit&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreExpr -&gt; Maybe PmLit
</span><a href="GHC.HsToCore.PmCheck.Types.html#coreExprAsPmLit"><span class="hs-identifier hs-var">coreExprAsPmLit</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144958"><span class="hs-identifier hs-var">core_expr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-528"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144947"><span class="annot"><span class="annottext">lit' :: PmLit
</span><a href="#local-6989586621681144947"><span class="hs-identifier hs-var hs-var">lit'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe (SyntaxExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681144962"><span class="hs-identifier hs-var">mb_neg</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-529"></span><span>          </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe PmLit -&gt; PmLit
forall a. HasCallStack =&gt; String -&gt; Maybe a -&gt; a
</span><a href="GHC.Data.Maybe.html#expectJust"><span class="hs-identifier hs-var">expectJust</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;failed to negate lit&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PmLit -&gt; Maybe PmLit
</span><a href="GHC.HsToCore.PmCheck.Types.html#negatePmLit"><span class="hs-identifier hs-var">negatePmLit</span></a></span><span> </span><span class="annot"><span class="annottext">PmLit
</span><a href="#local-6989586621681144950"><span class="hs-identifier hs-var">lit</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-530"></span><span>          </span><span class="annot"><span class="annottext">Maybe (SyntaxExpr (GhcPass 'Typechecked))
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">PmLit
</span><a href="#local-6989586621681144950"><span class="hs-identifier hs-var">lit</span></a></span><span>
</span><span id="line-531"></span><span>    </span><span class="annot"><span class="annottext">Id -&gt; PmLit -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#mkPmLitGrds"><span class="hs-identifier hs-var">mkPmLitGrds</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">PmLit
</span><a href="#local-6989586621681144947"><span class="hs-identifier hs-var">lit'</span></a></span><span>
</span><span id="line-532"></span><span>
</span><span id="line-533"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#LitPat"><span class="hs-identifier hs-type">LitPat</span></a></span><span> </span><span class="annot"><span class="annottext">XLitPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681144944"><span class="annot"><span class="annottext">HsLit (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144944"><span class="hs-identifier hs-var">lit</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-534"></span><span>    </span><span id="local-6989586621681144943"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144943"><span class="hs-identifier hs-var">core_expr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HsLit GhcRn -&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
</span><a href="GHC.HsToCore.Match.Literal.html#dsLit"><span class="hs-identifier hs-var">dsLit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsLit (GhcPass 'Typechecked) -&gt; HsLit GhcRn
forall (p1 :: Pass) (p2 :: Pass).
HsLit (GhcPass p1) -&gt; HsLit (GhcPass p2)
</span><a href="GHC.Hs.Lit.html#convertLit"><span class="hs-identifier hs-var">convertLit</span></a></span><span> </span><span class="annot"><span class="annottext">HsLit (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144944"><span class="hs-identifier hs-var">lit</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-535"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144941"><span class="annot"><span class="annottext">lit :: PmLit
</span><a href="#local-6989586621681144941"><span class="hs-identifier hs-var hs-var">lit</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe PmLit -&gt; PmLit
forall a. HasCallStack =&gt; String -&gt; Maybe a -&gt; a
</span><a href="GHC.Data.Maybe.html#expectJust"><span class="hs-identifier hs-var">expectJust</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;failed to detect Lit&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreExpr -&gt; Maybe PmLit
</span><a href="GHC.HsToCore.PmCheck.Types.html#coreExprAsPmLit"><span class="hs-identifier hs-var">coreExprAsPmLit</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144943"><span class="hs-identifier hs-var">core_expr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-536"></span><span>    </span><span class="annot"><span class="annottext">Id -&gt; PmLit -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#mkPmLitGrds"><span class="hs-identifier hs-var">mkPmLitGrds</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">PmLit
</span><a href="#local-6989586621681144941"><span class="hs-identifier hs-var">lit</span></a></span><span>
</span><span id="line-537"></span><span>
</span><span id="line-538"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#TuplePat"><span class="hs-identifier hs-type">TuplePat</span></a></span><span> </span><span id="local-6989586621681144939"><span class="annot"><span class="annottext">XTuplePat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144939"><span class="hs-identifier hs-var">_tys</span></a></span></span><span> </span><span id="local-6989586621681144938"><span class="annot"><span class="annottext">[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144938"><span class="hs-identifier hs-var">pats</span></a></span></span><span> </span><span id="local-6989586621681144937"><span class="annot"><span class="annottext">Boxity
</span><a href="#local-6989586621681144937"><span class="hs-identifier hs-var">boxity</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-539"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681144936"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144936"><span class="hs-identifier hs-var">vars</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144935"><span class="annot"><span class="annottext">[[PmGrd]]
</span><a href="#local-6989586621681144935"><span class="hs-identifier hs-var">grdss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Located (Pat (GhcPass 'Typechecked)) -&gt; DsM (Id, [PmGrd]))
-&gt; [Located (Pat (GhcPass 'Typechecked))]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) ([Id], [[PmGrd]])
forall (m :: * -&gt; *) a b c.
Applicative m =&gt;
(a -&gt; m (b, c)) -&gt; [a] -&gt; m ([b], [c])
</span><a href="../../base/src/Control.Monad.html#mapAndUnzipM"><span class="hs-identifier hs-var">mapAndUnzipM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FamInstEnvs -&gt; LPat (GhcPass 'Typechecked) -&gt; DsM (Id, [PmGrd])
</span><a href="GHC.HsToCore.PmCheck.html#translateLPatV"><span class="hs-identifier hs-var">translateLPatV</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Located (Pat (GhcPass 'Typechecked))]
[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144938"><span class="hs-identifier hs-var">pats</span></a></span><span>
</span><span id="line-540"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144933"><span class="annot"><span class="annottext">tuple_con :: DataCon
</span><a href="#local-6989586621681144933"><span class="hs-identifier hs-var hs-var">tuple_con</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Boxity -&gt; Int -&gt; DataCon
</span><a href="GHC.Builtin.Types.html#tupleDataCon"><span class="hs-identifier hs-var">tupleDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Boxity
</span><a href="#local-6989586621681144937"><span class="hs-identifier hs-var">boxity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Id] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144936"><span class="hs-identifier hs-var">vars</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-541"></span><span>    </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">([PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; [PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; DataCon -&gt; [Id] -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#vanillaConGrd"><span class="hs-identifier hs-var">vanillaConGrd</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681144933"><span class="hs-identifier hs-var">tuple_con</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144936"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; [PmGrd] -&gt; [PmGrd]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[[PmGrd]] -&gt; [PmGrd]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[PmGrd]]
</span><a href="#local-6989586621681144935"><span class="hs-identifier hs-var">grdss</span></a></span><span>
</span><span id="line-542"></span><span>
</span><span id="line-543"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#SumPat"><span class="hs-identifier hs-type">SumPat</span></a></span><span> </span><span id="local-6989586621681144928"><span class="annot"><span class="annottext">XSumPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144928"><span class="hs-identifier hs-var">_ty</span></a></span></span><span> </span><span id="local-6989586621681144927"><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144927"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621681144926"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144926"><span class="hs-identifier hs-var">alt</span></a></span></span><span> </span><span id="local-6989586621681144925"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144925"><span class="hs-identifier hs-var">arity</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-544"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681144924"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144924"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144923"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144923"><span class="hs-identifier hs-var">grds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs -&gt; LPat (GhcPass 'Typechecked) -&gt; DsM (Id, [PmGrd])
</span><a href="GHC.HsToCore.PmCheck.html#translateLPatV"><span class="hs-identifier hs-var">translateLPatV</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681145052"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144927"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-545"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144922"><span class="annot"><span class="annottext">sum_con :: DataCon
</span><a href="#local-6989586621681144922"><span class="hs-identifier hs-var hs-var">sum_con</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; DataCon
</span><a href="GHC.Builtin.Types.html#sumDataCon"><span class="hs-identifier hs-var">sumDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144926"><span class="hs-identifier hs-var">alt</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144925"><span class="hs-identifier hs-var">arity</span></a></span><span>
</span><span id="line-546"></span><span>    </span><span class="hs-comment">-- See Note [Unboxed tuple RuntimeRep vars] in GHC.Core.TyCon</span><span>
</span><span id="line-547"></span><span>    </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">([PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; [PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; DataCon -&gt; [Id] -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#vanillaConGrd"><span class="hs-identifier hs-var">vanillaConGrd</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681145051"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681144922"><span class="hs-identifier hs-var">sum_con</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144924"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; [PmGrd] -&gt; [PmGrd]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144923"><span class="hs-identifier hs-var">grds</span></a></span><span>
</span><span id="line-548"></span><span>
</span><span id="line-549"></span><span>  </span><span class="hs-comment">-- --------------------------------------------------------------------------</span><span>
</span><span id="line-550"></span><span>  </span><span class="hs-comment">-- Not supposed to happen</span><span>
</span><span id="line-551"></span><span>  </span><span class="annot"><a href="GHC.Hs.Pat.html#SplicePat"><span class="hs-identifier hs-type">SplicePat</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Check.translatePat: SplicePat&quot;</span></span><span>
</span><span id="line-552"></span><span>
</span><span id="line-553"></span><span class="hs-comment">-- | 'translatePat', but also select and return a new match var.</span><span>
</span><span id="line-554"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translatePatV"><span class="hs-identifier hs-type">translatePatV</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#Pat"><span class="hs-identifier hs-type">Pat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-555"></span><span id="translatePatV"><span class="annot"><span class="annottext">translatePatV :: FamInstEnvs -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM (Id, [PmGrd])
</span><a href="GHC.HsToCore.PmCheck.html#translatePatV"><span class="hs-identifier hs-var hs-var">translatePatV</span></a></span></span><span> </span><span id="local-6989586621681144918"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144918"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span id="local-6989586621681144917"><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144917"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-556"></span><span>  </span><span id="local-6989586621681144916"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144916"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM Id
</span><a href="GHC.HsToCore.Utils.html#selectMatchVar"><span class="hs-identifier hs-var">selectMatchVar</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144917"><span class="hs-identifier hs-var">pat</span></a></span><span>
</span><span id="line-557"></span><span>  </span><span id="local-6989586621681144914"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144914"><span class="hs-identifier hs-var">grds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; Pat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translatePat"><span class="hs-identifier hs-var">translatePat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144918"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144916"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Pat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144917"><span class="hs-identifier hs-var">pat</span></a></span><span>
</span><span id="line-558"></span><span>  </span><span class="annot"><span class="annottext">(Id, [PmGrd]) -&gt; DsM (Id, [PmGrd])
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144916"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144914"><span class="hs-identifier hs-var">grds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-559"></span><span>
</span><span id="line-560"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translateLPat"><span class="hs-identifier hs-type">translateLPat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span>
</span><span id="line-561"></span><span id="translateLPat"><span class="annot"><span class="annottext">translateLPat :: FamInstEnvs
-&gt; Id
-&gt; LPat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateLPat"><span class="hs-identifier hs-var hs-var">translateLPat</span></a></span></span><span> </span><span id="local-6989586621681144913"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144913"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span id="local-6989586621681144912"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144912"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; Pat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translatePat"><span class="hs-identifier hs-var">translatePat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144913"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144912"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">(Pat (GhcPass 'Typechecked)
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; (Located (Pat (GhcPass 'Typechecked))
    -&gt; Pat (GhcPass 'Typechecked))
-&gt; Located (Pat (GhcPass 'Typechecked))
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked)) -&gt; Pat (GhcPass 'Typechecked)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span>
</span><span id="line-562"></span><span>
</span><span id="line-563"></span><span class="hs-comment">-- | 'translateLPat', but also select and return a new match var.</span><span>
</span><span id="line-564"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translateLPatV"><span class="hs-identifier hs-type">translateLPatV</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-565"></span><span id="translateLPatV"><span class="annot"><span class="annottext">translateLPatV :: FamInstEnvs -&gt; LPat (GhcPass 'Typechecked) -&gt; DsM (Id, [PmGrd])
</span><a href="GHC.HsToCore.PmCheck.html#translateLPatV"><span class="hs-identifier hs-var hs-var">translateLPatV</span></a></span></span><span> </span><span id="local-6989586621681144911"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144911"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs -&gt; Pat (GhcPass 'Typechecked) -&gt; DsM (Id, [PmGrd])
</span><a href="GHC.HsToCore.PmCheck.html#translatePatV"><span class="hs-identifier hs-var">translatePatV</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144911"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">(Pat (GhcPass 'Typechecked) -&gt; DsM (Id, [PmGrd]))
-&gt; (Located (Pat (GhcPass 'Typechecked))
    -&gt; Pat (GhcPass 'Typechecked))
-&gt; Located (Pat (GhcPass 'Typechecked))
-&gt; DsM (Id, [PmGrd])
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked)) -&gt; Pat (GhcPass 'Typechecked)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span>
</span><span id="line-566"></span><span>
</span><span id="line-567"></span><span class="hs-comment">-- | @translateListPat _ x [p1, ..., pn]@ is basically</span><span>
</span><span id="line-568"></span><span class="hs-comment">--   @translateConPatOut _ x $(mkListConPatOuts [p1, ..., pn]&gt;@ without ever</span><span>
</span><span id="line-569"></span><span class="hs-comment">-- constructing the 'ConPatOut's.</span><span>
</span><span id="line-570"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translateListPat"><span class="hs-identifier hs-type">translateListPat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span>
</span><span id="line-571"></span><span id="translateListPat"><span class="annot"><span class="annottext">translateListPat :: FamInstEnvs
-&gt; Id
-&gt; [LPat (GhcPass 'Typechecked)]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateListPat"><span class="hs-identifier hs-var hs-var">translateListPat</span></a></span></span><span> </span><span id="local-6989586621681144910"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144910"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span id="local-6989586621681144909"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144909"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681144908"><span class="annot"><span class="annottext">[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144908"><span class="hs-identifier hs-var">pats</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-572"></span><span>  </span><span id="local-6989586621681144907"><span class="annot"><span class="annottext">[(Id, [PmGrd])]
</span><a href="#local-6989586621681144907"><span class="hs-identifier hs-var">vars_and_grdss</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Located (Pat (GhcPass 'Typechecked)) -&gt; DsM (Id, [PmGrd]))
-&gt; [Located (Pat (GhcPass 'Typechecked))]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [(Id, [PmGrd])]
forall (t :: * -&gt; *) (f :: * -&gt; *) a b.
(Traversable t, Applicative f) =&gt;
(a -&gt; f b) -&gt; t a -&gt; f (t b)
</span><a href="../../base/src/Data.Traversable.html#traverse"><span class="hs-identifier hs-var">traverse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FamInstEnvs -&gt; LPat (GhcPass 'Typechecked) -&gt; DsM (Id, [PmGrd])
</span><a href="GHC.HsToCore.PmCheck.html#translateLPatV"><span class="hs-identifier hs-var">translateLPatV</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144910"><span class="hs-identifier hs-var">fam_insts</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Located (Pat (GhcPass 'Typechecked))]
[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144908"><span class="hs-identifier hs-var">pats</span></a></span><span>
</span><span id="line-573"></span><span>  </span><span class="annot"><span class="annottext">Id -&gt; [(Id, [PmGrd])] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#mkListGrds"><span class="hs-identifier hs-var">mkListGrds</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144909"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">[(Id, [PmGrd])]
</span><a href="#local-6989586621681144907"><span class="hs-identifier hs-var">vars_and_grdss</span></a></span><span>
</span><span id="line-574"></span><span>
</span><span id="line-575"></span><span class="hs-comment">-- | Translate a constructor pattern</span><span>
</span><span id="line-576"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translateConPatOut"><span class="hs-identifier hs-type">translateConPatOut</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html#ConLike"><span class="hs-identifier hs-type">ConLike</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-577"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#HsConPatDetails"><span class="hs-identifier hs-type">HsConPatDetails</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span>
</span><span id="line-578"></span><span id="translateConPatOut"><span class="annot"><span class="annottext">translateConPatOut :: FamInstEnvs
-&gt; Id
-&gt; ConLike
-&gt; [Type]
-&gt; [Id]
-&gt; [Id]
-&gt; HsConPatDetails (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateConPatOut"><span class="hs-identifier hs-var hs-var">translateConPatOut</span></a></span></span><span> </span><span id="local-6989586621681144906"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144906"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span id="local-6989586621681144905"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144905"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681144904"><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681144904"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621681144903"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681144903"><span class="hs-identifier hs-var">univ_tys</span></a></span></span><span> </span><span id="local-6989586621681144902"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144902"><span class="hs-identifier hs-var">ex_tvs</span></a></span></span><span> </span><span id="local-6989586621681144901"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144901"><span class="hs-identifier hs-var">dicts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">\</span><span class="hs-glyph">case</span><span>
</span><span id="line-579"></span><span>    </span><span class="annot"><a href="GHC.Hs.Type.html#PrefixCon"><span class="hs-identifier hs-type">PrefixCon</span></a></span><span> </span><span id="local-6989586621681144899"><span class="annot"><span class="annottext">[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144899"><span class="hs-identifier hs-var">ps</span></a></span></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[(Int, Located (Pat (GhcPass 'Typechecked)))]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="#local-6989586621681144898"><span class="hs-identifier hs-var">go_field_pats</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Int]
-&gt; [Located (Pat (GhcPass 'Typechecked))]
-&gt; [(Int, Located (Pat (GhcPass 'Typechecked)))]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-glyph">..</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Located (Pat (GhcPass 'Typechecked))]
[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144899"><span class="hs-identifier hs-var">ps</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-580"></span><span>    </span><span class="annot"><a href="GHC.Hs.Type.html#InfixCon"><span class="hs-identifier hs-type">InfixCon</span></a></span><span>  </span><span id="local-6989586621681144896"><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144896"><span class="hs-identifier hs-var">p1</span></a></span></span><span> </span><span id="local-6989586621681144895"><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144895"><span class="hs-identifier hs-var">p2</span></a></span></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[(Int, Located (Pat (GhcPass 'Typechecked)))]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="#local-6989586621681144898"><span class="hs-identifier hs-var">go_field_pats</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Int]
-&gt; [Located (Pat (GhcPass 'Typechecked))]
-&gt; [(Int, Located (Pat (GhcPass 'Typechecked)))]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-identifier hs-var">zip</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-glyph">..</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked))
LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144896"><span class="hs-identifier hs-var">p1</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked))
LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144895"><span class="hs-identifier hs-var">p2</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-581"></span><span>    </span><span class="annot"><a href="GHC.Hs.Type.html#RecCon"><span class="hs-identifier hs-type">RecCon</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#HsRecFields"><span class="hs-identifier hs-type">HsRecFields</span></a></span><span> </span><span id="local-6989586621681144892"><span class="annot"><span class="annottext">[LHsRecField (GhcPass 'Typechecked) (LPat (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681144892"><span class="hs-identifier hs-var">fs</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe (Located Int)
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[(Int, Located (Pat (GhcPass 'Typechecked)))]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="#local-6989586621681144898"><span class="hs-identifier hs-var">go_field_pats</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[GenLocated
   SrcSpan
   (HsRecField
      (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked))))]
-&gt; [(Int, Located (Pat (GhcPass 'Typechecked)))]
</span><a href="#local-6989586621681144891"><span class="hs-identifier hs-var">rec_field_ps</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated
   SrcSpan
   (HsRecField
      (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked))))]
[LHsRecField (GhcPass 'Typechecked) (LPat (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681144892"><span class="hs-identifier hs-var">fs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-582"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-583"></span><span>    </span><span class="hs-comment">-- The actual argument types (instantiated)</span><span>
</span><span id="line-584"></span><span>    </span><span id="local-6989586621681144890"><span class="annot"><span class="annottext">arg_tys :: [Type]
</span><a href="#local-6989586621681144890"><span class="hs-identifier hs-var hs-var">arg_tys</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Scaled Type -&gt; Type) -&gt; [Scaled Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">([Scaled Type] -&gt; [Type]) -&gt; [Scaled Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; [Type] -&gt; [Scaled Type]
</span><a href="GHC.Core.ConLike.html#conLikeInstOrigArgTys"><span class="hs-identifier hs-var">conLikeInstOrigArgTys</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681144904"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681144903"><span class="hs-identifier hs-var">univ_tys</span></a></span><span> </span><span class="annot"><span class="annottext">[Type] -&gt; [Type] -&gt; [Type]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; [Type]
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTys"><span class="hs-identifier hs-var">mkTyVarTys</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144902"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-585"></span><span>
</span><span id="line-586"></span><span>    </span><span class="hs-comment">-- Extract record field patterns tagged by field index from a list of</span><span>
</span><span id="line-587"></span><span>    </span><span class="hs-comment">-- LHsRecField</span><span>
</span><span id="line-588"></span><span>    </span><span id="local-6989586621681144891"><span class="annot"><span class="annottext">rec_field_ps :: [GenLocated
   SrcSpan
   (HsRecField
      (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked))))]
-&gt; [(Int, Located (Pat (GhcPass 'Typechecked)))]
</span><a href="#local-6989586621681144891"><span class="hs-identifier hs-var hs-var">rec_field_ps</span></a></span></span><span> </span><span id="local-6989586621681144886"><span class="annot"><span class="annottext">[GenLocated
   SrcSpan
   (HsRecField
      (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked))))]
</span><a href="#local-6989586621681144886"><span class="hs-identifier hs-var">fs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(GenLocated
   SrcSpan
   (HsRecField
      (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked))))
 -&gt; (Int, Located (Pat (GhcPass 'Typechecked))))
-&gt; [GenLocated
      SrcSpan
      (HsRecField
         (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked))))]
-&gt; [(Int, Located (Pat (GhcPass 'Typechecked)))]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsRecField
  (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked)))
-&gt; (Int, Located (Pat (GhcPass 'Typechecked)))
</span><a href="#local-6989586621681144885"><span class="hs-identifier hs-var">tagged_pat</span></a></span><span> </span><span class="annot"><span class="annottext">(HsRecField
   (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked)))
 -&gt; (Int, Located (Pat (GhcPass 'Typechecked))))
-&gt; (GenLocated
      SrcSpan
      (HsRecField
         (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked))))
    -&gt; HsRecField
         (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked))))
-&gt; GenLocated
     SrcSpan
     (HsRecField
        (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked))))
-&gt; (Int, Located (Pat (GhcPass 'Typechecked)))
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated
  SrcSpan
  (HsRecField
     (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked))))
-&gt; HsRecField
     (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked)))
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[GenLocated
   SrcSpan
   (HsRecField
      (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked))))]
</span><a href="#local-6989586621681144886"><span class="hs-identifier hs-var">fs</span></a></span><span>
</span><span id="line-589"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-590"></span><span>        </span><span id="local-6989586621681144885"><span class="annot"><span class="annottext">tagged_pat :: HsRecField
  (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked)))
-&gt; (Int, Located (Pat (GhcPass 'Typechecked)))
</span><a href="#local-6989586621681144885"><span class="hs-identifier hs-var hs-var">tagged_pat</span></a></span></span><span> </span><span id="local-6989586621681144884"><span class="annot"><span class="annottext">HsRecField
  (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked)))
</span><a href="#local-6989586621681144884"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Int
</span><a href="#local-6989586621681144883"><span class="hs-identifier hs-var">lbl_to_index</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Id -&gt; Name
forall a. NamedThing a =&gt; a -&gt; Name
</span><a href="GHC.Types.Name.html#getName"><span class="hs-identifier hs-var">getName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsRecField
  (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked)))
-&gt; Located Id
forall arg. HsRecField (GhcPass 'Typechecked) arg -&gt; Located Id
</span><a href="GHC.Hs.Pat.html#hsRecFieldId"><span class="hs-identifier hs-var">hsRecFieldId</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecField
  (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked)))
</span><a href="#local-6989586621681144884"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HsRecField
  (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked)))
-&gt; Located (Pat (GhcPass 'Typechecked))
forall id arg. HsRecField' id arg -&gt; arg
</span><a href="GHC.Hs.Pat.html#hsRecFieldArg"><span class="hs-identifier hs-var hs-var">hsRecFieldArg</span></a></span><span> </span><span class="annot"><span class="annottext">HsRecField
  (GhcPass 'Typechecked) (Located (Pat (GhcPass 'Typechecked)))
</span><a href="#local-6989586621681144884"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-591"></span><span>        </span><span class="hs-comment">-- Unfortunately the label info is empty when the DataCon wasn't defined</span><span>
</span><span id="line-592"></span><span>        </span><span class="hs-comment">-- with record field labels, hence we translate to field index.</span><span>
</span><span id="line-593"></span><span>        </span><span id="local-6989586621681144879"><span class="annot"><span class="annottext">orig_lbls :: [Name]
</span><a href="#local-6989586621681144879"><span class="hs-identifier hs-var hs-var">orig_lbls</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(FieldLbl Name -&gt; Name) -&gt; [FieldLbl Name] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">FieldLbl Name -&gt; Name
forall a. FieldLbl a -&gt; a
</span><a href="GHC.Types.FieldLabel.html#flSelector"><span class="hs-identifier hs-var hs-var">flSelector</span></a></span><span> </span><span class="annot"><span class="annottext">([FieldLbl Name] -&gt; [Name]) -&gt; [FieldLbl Name] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; [FieldLbl Name]
</span><a href="GHC.Core.ConLike.html#conLikeFieldLabels"><span class="hs-identifier hs-var">conLikeFieldLabels</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681144904"><span class="hs-identifier hs-var">con</span></a></span><span>
</span><span id="line-594"></span><span>        </span><span id="local-6989586621681144883"><span class="annot"><span class="annottext">lbl_to_index :: Name -&gt; Int
</span><a href="#local-6989586621681144883"><span class="hs-identifier hs-var hs-var">lbl_to_index</span></a></span></span><span> </span><span id="local-6989586621681144876"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681144876"><span class="hs-identifier hs-var">lbl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Maybe Int -&gt; Int
forall a. HasCallStack =&gt; String -&gt; Maybe a -&gt; a
</span><a href="GHC.Data.Maybe.html#expectJust"><span class="hs-identifier hs-var">expectJust</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;lbl_to_index&quot;</span></span><span> </span><span class="annot"><span class="annottext">(Maybe Int -&gt; Int) -&gt; Maybe Int -&gt; Int
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; [Name] -&gt; Maybe Int
forall a. Eq a =&gt; a -&gt; [a] -&gt; Maybe Int
</span><a href="../../base/src/Data.OldList.html#elemIndex"><span class="hs-identifier hs-var">elemIndex</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681144876"><span class="hs-identifier hs-var">lbl</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681144879"><span class="hs-identifier hs-var">orig_lbls</span></a></span><span>
</span><span id="line-595"></span><span>
</span><span id="line-596"></span><span>    </span><span id="local-6989586621681144898"><span class="annot"><span class="annottext">go_field_pats :: [(Int, Located (Pat (GhcPass 'Typechecked)))]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="#local-6989586621681144898"><span class="hs-identifier hs-var hs-var">go_field_pats</span></a></span></span><span> </span><span id="local-6989586621681144875"><span class="annot"><span class="annottext">[(Int, Located (Pat (GhcPass 'Typechecked)))]
</span><a href="#local-6989586621681144875"><span class="hs-identifier hs-var">tagged_pats</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-597"></span><span>      </span><span class="hs-comment">-- The fields that appear might not be in the correct order. So first</span><span>
</span><span id="line-598"></span><span>      </span><span class="hs-comment">-- do a PmCon match, then force according to field strictness and then</span><span>
</span><span id="line-599"></span><span>      </span><span class="hs-comment">-- force evaluation of the field patterns in the order given by</span><span>
</span><span id="line-600"></span><span>      </span><span class="hs-comment">-- the first field of @tagged_pats@.</span><span>
</span><span id="line-601"></span><span>      </span><span class="hs-comment">-- See Note [Field match order for RecCon]</span><span>
</span><span id="line-602"></span><span>
</span><span id="line-603"></span><span>      </span><span class="hs-comment">-- Translate the mentioned field patterns. We're doing this first to get</span><span>
</span><span id="line-604"></span><span>      </span><span class="hs-comment">-- the Ids for pm_con_args.</span><span>
</span><span id="line-605"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144874"><span class="annot"><span class="annottext">trans_pat :: (Int, Located (Pat (GhcPass 'Typechecked)))
-&gt; IOEnv (Env DsGblEnv DsLclEnv) ((Int, Id), [PmGrd])
</span><a href="#local-6989586621681144874"><span class="hs-identifier hs-var hs-var">trans_pat</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681144873"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144873"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144872"><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked))
</span><a href="#local-6989586621681144872"><span class="hs-identifier hs-var">pat</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-606"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621681144871"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144871"><span class="hs-identifier hs-var">var</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144870"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144870"><span class="hs-identifier hs-var">pvec</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs -&gt; LPat (GhcPass 'Typechecked) -&gt; DsM (Id, [PmGrd])
</span><a href="GHC.HsToCore.PmCheck.html#translateLPatV"><span class="hs-identifier hs-var">translateLPatV</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144906"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked))
LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144872"><span class="hs-identifier hs-var">pat</span></a></span><span>
</span><span id="line-607"></span><span>            </span><span class="annot"><span class="annottext">((Int, Id), [PmGrd])
-&gt; IOEnv (Env DsGblEnv DsLclEnv) ((Int, Id), [PmGrd])
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144873"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144871"><span class="hs-identifier hs-var">var</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144870"><span class="hs-identifier hs-var">pvec</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-608"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621681144869"><span class="annot"><span class="annottext">[(Int, Id)]
</span><a href="#local-6989586621681144869"><span class="hs-identifier hs-var">tagged_vars</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144868"><span class="annot"><span class="annottext">[[PmGrd]]
</span><a href="#local-6989586621681144868"><span class="hs-identifier hs-var">arg_grdss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">((Int, Located (Pat (GhcPass 'Typechecked)))
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) ((Int, Id), [PmGrd]))
-&gt; [(Int, Located (Pat (GhcPass 'Typechecked)))]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) ([(Int, Id)], [[PmGrd]])
forall (m :: * -&gt; *) a b c.
Applicative m =&gt;
(a -&gt; m (b, c)) -&gt; [a] -&gt; m ([b], [c])
</span><a href="../../base/src/Control.Monad.html#mapAndUnzipM"><span class="hs-identifier hs-var">mapAndUnzipM</span></a></span><span> </span><span class="annot"><span class="annottext">(Int, Located (Pat (GhcPass 'Typechecked)))
-&gt; IOEnv (Env DsGblEnv DsLclEnv) ((Int, Id), [PmGrd])
</span><a href="#local-6989586621681144874"><span class="hs-identifier hs-var">trans_pat</span></a></span><span> </span><span class="annot"><span class="annottext">[(Int, Located (Pat (GhcPass 'Typechecked)))]
</span><a href="#local-6989586621681144875"><span class="hs-identifier hs-var">tagged_pats</span></a></span><span>
</span><span id="line-609"></span><span>
</span><span id="line-610"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144867"><span class="annot"><span class="annottext">get_pat_id :: Int -&gt; Type -&gt; DsM Id
</span><a href="#local-6989586621681144867"><span class="hs-identifier hs-var hs-var">get_pat_id</span></a></span></span><span> </span><span id="local-6989586621681144866"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144866"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621681144865"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681144865"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [(Int, Id)] -&gt; Maybe Id
forall a b. Eq a =&gt; a -&gt; [(a, b)] -&gt; Maybe b
</span><a href="../../base/src/GHC.List.html#lookup"><span class="hs-identifier hs-var">lookup</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144866"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">[(Int, Id)]
</span><a href="#local-6989586621681144869"><span class="hs-identifier hs-var">tagged_vars</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-611"></span><span>            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681144863"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144863"><span class="hs-identifier hs-var">var</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Id -&gt; DsM Id
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144863"><span class="hs-identifier hs-var">var</span></a></span><span>
</span><span id="line-612"></span><span>            </span><span class="annot"><span class="annottext">Maybe Id
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Type -&gt; DsM Id
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#mkPmId"><span class="hs-identifier hs-var">mkPmId</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681144865"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-613"></span><span>
</span><span id="line-614"></span><span>      </span><span class="hs-comment">-- 1. the constructor pattern match itself</span><span>
</span><span id="line-615"></span><span>      </span><span id="local-6989586621681144862"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144862"><span class="hs-identifier hs-var">arg_ids</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Int -&gt; Type -&gt; DsM Id)
-&gt; [Int] -&gt; [Type] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [Id]
forall (m :: * -&gt; *) a b c.
Applicative m =&gt;
(a -&gt; b -&gt; m c) -&gt; [a] -&gt; [b] -&gt; m [c]
</span><a href="../../base/src/Control.Monad.html#zipWithM"><span class="hs-identifier hs-var">zipWithM</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Type -&gt; DsM Id
</span><a href="#local-6989586621681144867"><span class="hs-identifier hs-var">get_pat_id</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-glyph">..</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621681144890"><span class="hs-identifier hs-var">arg_tys</span></a></span><span>
</span><span id="line-616"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144861"><span class="annot"><span class="annottext">con_grd :: PmGrd
</span><a href="#local-6989586621681144861"><span class="hs-identifier hs-var hs-var">con_grd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Id -&gt; PmAltCon -&gt; [Id] -&gt; [Id] -&gt; [Id] -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmCon"><span class="hs-identifier hs-var">PmCon</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144905"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConLike -&gt; PmAltCon
</span><a href="GHC.HsToCore.PmCheck.Types.html#PmAltConLike"><span class="hs-identifier hs-var">PmAltConLike</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681144904"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144902"><span class="hs-identifier hs-var">ex_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144901"><span class="hs-identifier hs-var">dicts</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144862"><span class="hs-identifier hs-var">arg_ids</span></a></span><span>
</span><span id="line-617"></span><span>
</span><span id="line-618"></span><span>      </span><span class="hs-comment">-- 2. bang strict fields</span><span>
</span><span id="line-619"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144860"><span class="annot"><span class="annottext">arg_is_banged :: [Bool]
</span><a href="#local-6989586621681144860"><span class="hs-identifier hs-var hs-var">arg_is_banged</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(HsImplBang -&gt; Bool) -&gt; [HsImplBang] -&gt; [Bool]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">HsImplBang -&gt; Bool
</span><a href="GHC.Core.DataCon.html#isBanged"><span class="hs-identifier hs-var">isBanged</span></a></span><span> </span><span class="annot"><span class="annottext">([HsImplBang] -&gt; [Bool]) -&gt; [HsImplBang] -&gt; [Bool]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; [HsImplBang]
</span><a href="GHC.Core.ConLike.html#conLikeImplBangs"><span class="hs-identifier hs-var">conLikeImplBangs</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681144904"><span class="hs-identifier hs-var">con</span></a></span><span>
</span><span id="line-620"></span><span>          </span><span id="local-6989586621681144857"><span class="annot"><span class="annottext">bang_grds :: [PmGrd]
</span><a href="#local-6989586621681144857"><span class="hs-identifier hs-var hs-var">bang_grds</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Id -&gt; PmGrd) -&gt; [Id] -&gt; [PmGrd]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmBang"><span class="hs-identifier hs-var">PmBang</span></a></span><span>   </span><span class="annot"><span class="annottext">([Id] -&gt; [PmGrd]) -&gt; [Id] -&gt; [PmGrd]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool] -&gt; [Id] -&gt; [Id]
forall a. [Bool] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#filterByList"><span class="hs-identifier hs-var">filterByList</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621681144860"><span class="hs-identifier hs-var">arg_is_banged</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144862"><span class="hs-identifier hs-var">arg_ids</span></a></span><span>
</span><span id="line-621"></span><span>
</span><span id="line-622"></span><span>      </span><span class="hs-comment">-- 3. guards from field selector patterns</span><span>
</span><span id="line-623"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144855"><span class="annot"><span class="annottext">arg_grds :: [PmGrd]
</span><a href="#local-6989586621681144855"><span class="hs-identifier hs-var hs-var">arg_grds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[[PmGrd]] -&gt; [PmGrd]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">[[PmGrd]]
</span><a href="#local-6989586621681144868"><span class="hs-identifier hs-var">arg_grdss</span></a></span><span>
</span><span id="line-624"></span><span>
</span><span id="line-625"></span><span>      </span><span class="hs-comment">-- tracePm &quot;ConPatOut&quot; (ppr x $$ ppr con $$ ppr arg_ids)</span><span>
</span><span id="line-626"></span><span>      </span><span class="hs-comment">--</span><span>
</span><span id="line-627"></span><span>      </span><span class="hs-comment">-- Store the guards in exactly that order</span><span>
</span><span id="line-628"></span><span>      </span><span class="hs-comment">--      1.         2.           3.</span><span>
</span><span id="line-629"></span><span>      </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PmGrd
</span><a href="#local-6989586621681144861"><span class="hs-identifier hs-var">con_grd</span></a></span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; [PmGrd] -&gt; [PmGrd]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144857"><span class="hs-identifier hs-var">bang_grds</span></a></span><span> </span><span class="annot"><span class="annottext">[PmGrd] -&gt; [PmGrd] -&gt; [PmGrd]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144855"><span class="hs-identifier hs-var">arg_grds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-630"></span><span>
</span><span id="line-631"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#mkGrdTreeRhs"><span class="hs-identifier hs-type">mkGrdTreeRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-type">GrdTree</span></a></span><span>
</span><span id="line-632"></span><span id="mkGrdTreeRhs"><span class="annot"><span class="annottext">mkGrdTreeRhs :: RhsInfo -&gt; [PmGrd] -&gt; GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#mkGrdTreeRhs"><span class="hs-identifier hs-var hs-var">mkGrdTreeRhs</span></a></span></span><span> </span><span id="local-6989586621681144854"><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681144854"><span class="hs-identifier hs-var">sdoc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(PmGrd -&gt; GrdTree -&gt; GrdTree) -&gt; GrdTree -&gt; [PmGrd] -&gt; GrdTree
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; GrdTree -&gt; GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#Guard"><span class="hs-identifier hs-var">Guard</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RhsInfo -&gt; GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#Rhs"><span class="hs-identifier hs-var">Rhs</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681144854"><span class="hs-identifier hs-var">sdoc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-633"></span><span>
</span><span id="line-634"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#mkGrdTreeMany"><span class="hs-identifier hs-type">mkGrdTreeMany</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-type">GrdTree</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-type">GrdTree</span></a></span><span>
</span><span id="line-635"></span><span id="mkGrdTreeMany"><span class="annot"><span class="annottext">mkGrdTreeMany :: [PmGrd] -&gt; [GrdTree] -&gt; GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#mkGrdTreeMany"><span class="hs-identifier hs-var hs-var">mkGrdTreeMany</span></a></span></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span>
</span><span id="line-636"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#mkGrdTreeMany"><span class="hs-identifier hs-var">mkGrdTreeMany</span></a></span><span> </span><span id="local-6989586621681144852"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144852"><span class="hs-identifier hs-var">grds</span></a></span></span><span> </span><span id="local-6989586621681144851"><span class="annot"><span class="annottext">[GrdTree]
</span><a href="#local-6989586621681144851"><span class="hs-identifier hs-var">trees</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(PmGrd -&gt; GrdTree -&gt; GrdTree) -&gt; GrdTree -&gt; [PmGrd] -&gt; GrdTree
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; GrdTree -&gt; GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#Guard"><span class="hs-identifier hs-var">Guard</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(GrdTree -&gt; GrdTree -&gt; GrdTree) -&gt; [GrdTree] -&gt; GrdTree
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; a -&gt; a) -&gt; t a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#foldr1"><span class="hs-identifier hs-var">foldr1</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; GrdTree -&gt; GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#Sequence"><span class="hs-identifier hs-var">Sequence</span></a></span><span> </span><span class="annot"><span class="annottext">[GrdTree]
</span><a href="#local-6989586621681144851"><span class="hs-identifier hs-var">trees</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144852"><span class="hs-identifier hs-var">grds</span></a></span><span>
</span><span id="line-637"></span><span>
</span><span id="line-638"></span><span class="hs-comment">-- Translate a single match</span><span>
</span><span id="line-639"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translateMatch"><span class="hs-identifier hs-type">translateMatch</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LMatch"><span class="hs-identifier hs-type">LMatch</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-640"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-type">GrdTree</span></a></span><span>
</span><span id="line-641"></span><span id="translateMatch"><span class="annot"><span class="annottext">translateMatch :: FamInstEnvs
-&gt; [Id]
-&gt; LMatch (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
-&gt; IOEnv (Env DsGblEnv DsLclEnv) GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#translateMatch"><span class="hs-identifier hs-var hs-var">translateMatch</span></a></span></span><span> </span><span id="local-6989586621681144849"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144849"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span id="local-6989586621681144848"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144848"><span class="hs-identifier hs-var">vars</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681144847"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144847"><span class="hs-identifier hs-var">match_loc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#Match"><span class="hs-identifier hs-type">Match</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">m_pats :: forall p body. Match p body -&gt; [LPat p]
</span><a href="GHC.Hs.Expr.html#m_pats"><span class="hs-identifier hs-var">m_pats</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681144846"><span class="annot"><span class="annottext">[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144846"><span class="hs-identifier hs-var">pats</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">m_grhss :: forall p body. Match p body -&gt; GRHSs p body
</span><a href="GHC.Hs.Expr.html#m_grhss"><span class="hs-identifier hs-var">m_grhss</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681144845"><span class="annot"><span class="annottext">GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681144845"><span class="hs-identifier hs-var">grhss</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-642"></span><span>  </span><span id="local-6989586621681144844"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144844"><span class="hs-identifier hs-var">pats'</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[[PmGrd]] -&gt; [PmGrd]
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="../../base/src/Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="annot"><span class="annottext">([[PmGrd]] -&gt; [PmGrd])
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [[PmGrd]]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(Id
 -&gt; Located (Pat (GhcPass 'Typechecked))
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; [Id]
-&gt; [Located (Pat (GhcPass 'Typechecked))]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [[PmGrd]]
forall (m :: * -&gt; *) a b c.
Applicative m =&gt;
(a -&gt; b -&gt; m c) -&gt; [a] -&gt; [b] -&gt; m [c]
</span><a href="../../base/src/Control.Monad.html#zipWithM"><span class="hs-identifier hs-var">zipWithM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; LPat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateLPat"><span class="hs-identifier hs-var">translateLPat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144849"><span class="hs-identifier hs-var">fam_insts</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144848"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="annot"><span class="annottext">[Located (Pat (GhcPass 'Typechecked))]
[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144846"><span class="hs-identifier hs-var">pats</span></a></span><span>
</span><span id="line-643"></span><span>  </span><span id="local-6989586621681144843"><span class="annot"><span class="annottext">[GrdTree]
</span><a href="#local-6989586621681144843"><span class="hs-identifier hs-var">grhss'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LGRHS (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) GrdTree)
-&gt; [LGRHS (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [GrdTree]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; SrcSpan
-&gt; [LPat (GhcPass 'Typechecked)]
-&gt; LGRHS (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
-&gt; IOEnv (Env DsGblEnv DsLclEnv) GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#translateLGRHS"><span class="hs-identifier hs-var">translateLGRHS</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144849"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144847"><span class="hs-identifier hs-var">match_loc</span></a></span><span> </span><span class="annot"><span class="annottext">[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144846"><span class="hs-identifier hs-var">pats</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
-&gt; [LGRHS (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))]
forall p body. GRHSs p body -&gt; [LGRHS p body]
</span><a href="GHC.Hs.Expr.html#grhssGRHSs"><span class="hs-identifier hs-var hs-var">grhssGRHSs</span></a></span><span> </span><span class="annot"><span class="annottext">GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681144845"><span class="hs-identifier hs-var">grhss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-644"></span><span>  </span><span class="hs-comment">-- tracePm &quot;translateMatch&quot; (vcat [ppr pats, ppr pats', ppr grhss, ppr grhss'])</span><span>
</span><span id="line-645"></span><span>  </span><span class="annot"><span class="annottext">GrdTree -&gt; IOEnv (Env DsGblEnv DsLclEnv) GrdTree
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[PmGrd] -&gt; [GrdTree] -&gt; GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#mkGrdTreeMany"><span class="hs-identifier hs-var">mkGrdTreeMany</span></a></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144844"><span class="hs-identifier hs-var">pats'</span></a></span><span> </span><span class="annot"><span class="annottext">[GrdTree]
</span><a href="#local-6989586621681144843"><span class="hs-identifier hs-var">grhss'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-646"></span><span>
</span><span id="line-647"></span><span class="hs-comment">-- -----------------------------------------------------------------------</span><span>
</span><span id="line-648"></span><span class="hs-comment">-- * Transform source guards (GuardStmt Id) to simpler PmGrds</span><span>
</span><span id="line-649"></span><span>
</span><span id="line-650"></span><span class="hs-comment">-- | Translate a guarded right-hand side to a single 'GrdTree'</span><span>
</span><span id="line-651"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translateLGRHS"><span class="hs-identifier hs-type">translateLGRHS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LGRHS"><span class="hs-identifier hs-type">LGRHS</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-type">GrdTree</span></a></span><span>
</span><span id="line-652"></span><span id="translateLGRHS"><span class="annot"><span class="annottext">translateLGRHS :: FamInstEnvs
-&gt; SrcSpan
-&gt; [LPat (GhcPass 'Typechecked)]
-&gt; LGRHS (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
-&gt; IOEnv (Env DsGblEnv DsLclEnv) GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#translateLGRHS"><span class="hs-identifier hs-var hs-var">translateLGRHS</span></a></span></span><span> </span><span id="local-6989586621681144840"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144840"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span id="local-6989586621681144839"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144839"><span class="hs-identifier hs-var">match_loc</span></a></span></span><span> </span><span id="local-6989586621681144838"><span class="annot"><span class="annottext">[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144838"><span class="hs-identifier hs-var">pats</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681144837"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144837"><span class="hs-identifier hs-var">_loc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#GRHS"><span class="hs-identifier hs-type">GRHS</span></a></span><span> </span><span class="annot"><span class="annottext">XCGRHS (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681144835"><span class="annot"><span class="annottext">[GuardLStmt (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144835"><span class="hs-identifier hs-var">gs</span></a></span></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-653"></span><span>  </span><span class="hs-comment">-- _loc apparently points to the match separator that comes after the guards..</span><span>
</span><span id="line-654"></span><span>  </span><span class="annot"><span class="annottext">RhsInfo -&gt; [PmGrd] -&gt; GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#mkGrdTreeRhs"><span class="hs-identifier hs-var">mkGrdTreeRhs</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681144834"><span class="hs-identifier hs-var">loc_sdoc</span></a></span><span> </span><span class="annot"><span class="annottext">([PmGrd] -&gt; GrdTree)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) GrdTree
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(GuardLStmt (GhcPass 'Typechecked)
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; [GuardLStmt (GhcPass 'Typechecked)]
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m [b]) -&gt; [a] -&gt; m [b]
</span><a href="GHC.Utils.Monad.html#concatMapM"><span class="hs-identifier hs-var">concatMapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; StmtLR
     (GhcPass 'Typechecked)
     (GhcPass 'Typechecked)
     (LHsExpr (GhcPass 'Typechecked))
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateGuard"><span class="hs-identifier hs-var">translateGuard</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144840"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">(StmtLR
   (GhcPass 'Typechecked)
   (GhcPass 'Typechecked)
   (LHsExpr (GhcPass 'Typechecked))
 -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; (GuardLStmt (GhcPass 'Typechecked)
    -&gt; StmtLR
         (GhcPass 'Typechecked)
         (GhcPass 'Typechecked)
         (LHsExpr (GhcPass 'Typechecked)))
-&gt; GuardLStmt (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">GuardLStmt (GhcPass 'Typechecked)
-&gt; StmtLR
     (GhcPass 'Typechecked)
     (GhcPass 'Typechecked)
     (LHsExpr (GhcPass 'Typechecked))
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[GuardLStmt (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144835"><span class="hs-identifier hs-var">gs</span></a></span><span>
</span><span id="line-655"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-656"></span><span>      </span><span id="local-6989586621681144834"><span class="annot"><span class="annottext">loc_sdoc :: RhsInfo
</span><a href="#local-6989586621681144834"><span class="hs-identifier hs-var hs-var">loc_sdoc</span></a></span></span><span>
</span><span id="line-657"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[GuardLStmt (GhcPass 'Typechecked)] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[GuardLStmt (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144835"><span class="hs-identifier hs-var">gs</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; SDoc -&gt; RhsInfo
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144839"><span class="hs-identifier hs-var">match_loc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#sep"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Located (Pat (GhcPass 'Typechecked)) -&gt; SDoc)
-&gt; [Located (Pat (GhcPass 'Typechecked))] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked)) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Located (Pat (GhcPass 'Typechecked))]
[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144838"><span class="hs-identifier hs-var">pats</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-658"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; SDoc -&gt; RhsInfo
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144831"><span class="hs-identifier hs-var">grd_loc</span></a></span><span>   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#sep"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Located (Pat (GhcPass 'Typechecked)) -&gt; SDoc)
-&gt; [Located (Pat (GhcPass 'Typechecked))] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked)) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Located (Pat (GhcPass 'Typechecked))]
[LPat (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144838"><span class="hs-identifier hs-var">pats</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#vbar"><span class="hs-identifier hs-var">vbar</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[GuardLStmt (GhcPass 'Typechecked)] -&gt; SDoc
forall a. Outputable a =&gt; [a] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#interpp%27SP"><span class="hs-identifier hs-var">interpp'SP</span></a></span><span> </span><span class="annot"><span class="annottext">[GuardLStmt (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144835"><span class="hs-identifier hs-var">gs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-659"></span><span>      </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681144831"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144831"><span class="hs-identifier hs-var">grd_loc</span></a></span></span><span> </span><span class="annot"><span class="annottext">StmtLR
  (GhcPass 'Typechecked)
  (GhcPass 'Typechecked)
  (LHsExpr (GhcPass 'Typechecked))
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GuardLStmt (GhcPass 'Typechecked)]
-&gt; GuardLStmt (GhcPass 'Typechecked)
forall a. [a] -&gt; a
</span><a href="../../base/src/GHC.List.html#head"><span class="hs-identifier hs-var">head</span></a></span><span> </span><span class="annot"><span class="annottext">[GuardLStmt (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681144835"><span class="hs-identifier hs-var">gs</span></a></span><span>
</span><span id="line-660"></span><span>
</span><span id="line-661"></span><span class="hs-comment">-- | Translate a guard statement to a 'GrdVec'</span><span>
</span><span id="line-662"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translateGuard"><span class="hs-identifier hs-type">translateGuard</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#GuardStmt"><span class="hs-identifier hs-type">GuardStmt</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span>
</span><span id="line-663"></span><span id="translateGuard"><span class="annot"><span class="annottext">translateGuard :: FamInstEnvs
-&gt; StmtLR
     (GhcPass 'Typechecked)
     (GhcPass 'Typechecked)
     (LHsExpr (GhcPass 'Typechecked))
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateGuard"><span class="hs-identifier hs-var hs-var">translateGuard</span></a></span></span><span> </span><span id="local-6989586621681144826"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144826"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span id="local-6989586621681144825"><span class="annot"><span class="annottext">StmtLR
  (GhcPass 'Typechecked)
  (GhcPass 'Typechecked)
  (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681144825"><span class="hs-identifier hs-var">guard</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">StmtLR
  (GhcPass 'Typechecked)
  (GhcPass 'Typechecked)
  (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681144825"><span class="hs-identifier hs-var">guard</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-664"></span><span>  </span><span class="annot"><a href="GHC.Hs.Expr.html#BodyStmt"><span class="hs-identifier hs-type">BodyStmt</span></a></span><span> </span><span class="annot"><span class="annottext">XBodyStmt
  (GhcPass 'Typechecked)
  (GhcPass 'Typechecked)
  (LHsExpr (GhcPass 'Typechecked))
</span><span class="hs-identifier">_</span></span><span>   </span><span id="local-6989586621681144823"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144823"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">SyntaxExpr (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateBoolGuard"><span class="hs-identifier hs-var">translateBoolGuard</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144823"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-665"></span><span>  </span><span class="annot"><a href="GHC.Hs.Expr.html#LetStmt"><span class="hs-identifier hs-type">LetStmt</span></a></span><span>  </span><span class="annot"><span class="annottext">XLetStmt
  (GhcPass 'Typechecked)
  (GhcPass 'Typechecked)
  (LHsExpr (GhcPass 'Typechecked))
</span><span class="hs-identifier">_</span></span><span>   </span><span id="local-6989586621681144820"><span class="annot"><span class="annottext">LHsLocalBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144820"><span class="hs-identifier hs-var">binds</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HsLocalBinds (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateLet"><span class="hs-identifier hs-var">translateLet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsLocalBinds (GhcPass 'Typechecked)
-&gt; HsLocalBinds (GhcPass 'Typechecked)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">LHsLocalBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144820"><span class="hs-identifier hs-var">binds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-666"></span><span>  </span><span class="annot"><a href="GHC.Hs.Expr.html#BindStmt"><span class="hs-identifier hs-type">BindStmt</span></a></span><span> </span><span class="annot"><span class="annottext">XBindStmt
  (GhcPass 'Typechecked)
  (GhcPass 'Typechecked)
  (LHsExpr (GhcPass 'Typechecked))
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681144817"><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144817"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621681144816"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144816"><span class="hs-identifier hs-var">e</span></a></span></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; LPat (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateBind"><span class="hs-identifier hs-var">translateBind</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144826"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144817"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144816"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-667"></span><span>  </span><span class="annot"><a href="GHC.Hs.Expr.html#LastStmt"><span class="hs-identifier hs-type">LastStmt</span></a></span><span>        </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;translateGuard LastStmt&quot;</span></span><span>
</span><span id="line-668"></span><span>  </span><span class="annot"><a href="GHC.Hs.Expr.html#ParStmt"><span class="hs-identifier hs-type">ParStmt</span></a></span><span>         </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;translateGuard ParStmt&quot;</span></span><span>
</span><span id="line-669"></span><span>  </span><span class="annot"><a href="GHC.Hs.Expr.html#TransStmt"><span class="hs-identifier hs-type">TransStmt</span></a></span><span>       </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;translateGuard TransStmt&quot;</span></span><span>
</span><span id="line-670"></span><span>  </span><span class="annot"><a href="GHC.Hs.Expr.html#RecStmt"><span class="hs-identifier hs-type">RecStmt</span></a></span><span>         </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;translateGuard RecStmt&quot;</span></span><span>
</span><span id="line-671"></span><span>  </span><span class="annot"><a href="GHC.Hs.Expr.html#ApplicativeStmt"><span class="hs-identifier hs-type">ApplicativeStmt</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;translateGuard ApplicativeLastStmt&quot;</span></span><span>
</span><span id="line-672"></span><span>
</span><span id="line-673"></span><span class="hs-comment">-- | Translate let-bindings</span><span>
</span><span id="line-674"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translateLet"><span class="hs-identifier hs-type">translateLet</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#HsLocalBinds"><span class="hs-identifier hs-type">HsLocalBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span>
</span><span id="line-675"></span><span id="translateLet"><span class="annot"><span class="annottext">translateLet :: HsLocalBinds (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateLet"><span class="hs-identifier hs-var hs-var">translateLet</span></a></span></span><span> </span><span id="local-6989586621681144809"><span class="annot"><span class="annottext">HsLocalBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144809"><span class="hs-identifier hs-var">_binds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-676"></span><span>
</span><span id="line-677"></span><span class="hs-comment">-- | Translate a pattern guard</span><span>
</span><span id="line-678"></span><span class="hs-comment">--   @pat &lt;- e ==&gt;  let x = e;  &lt;guards for pat &lt;- x&gt;@</span><span>
</span><span id="line-679"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translateBind"><span class="hs-identifier hs-type">translateBind</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#FamInstEnvs"><span class="hs-identifier hs-type">FamInstEnvs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span>
</span><span id="line-680"></span><span id="translateBind"><span class="annot"><span class="annottext">translateBind :: FamInstEnvs
-&gt; LPat (GhcPass 'Typechecked)
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateBind"><span class="hs-identifier hs-var hs-var">translateBind</span></a></span></span><span> </span><span id="local-6989586621681144808"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144808"><span class="hs-identifier hs-var">fam_insts</span></a></span></span><span> </span><span id="local-6989586621681144807"><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144807"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621681144806"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144806"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
</span><a href="GHC.HsToCore.Expr.html#dsLExpr"><span class="hs-identifier hs-var">dsLExpr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144806"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
-&gt; (CoreExpr -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-glyph">case</span><span>
</span><span id="line-681"></span><span>  </span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621681144805"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144805"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-682"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Maybe DataCon
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Maybe DataCon
</span><a href="GHC.Types.Id.html#isDataConId_maybe"><span class="hs-identifier hs-var">isDataConId_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144805"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-683"></span><span>    </span><span class="hs-comment">-- RHS is a variable, so that will allow us to omit the let</span><span>
</span><span id="line-684"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
-&gt; Id
-&gt; LPat (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateLPat"><span class="hs-identifier hs-var">translateLPat</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144808"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144805"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144807"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-685"></span><span>  </span><span id="local-6989586621681144803"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144803"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-686"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681144802"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144802"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144801"><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144801"><span class="hs-identifier hs-var">grds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs -&gt; LPat (GhcPass 'Typechecked) -&gt; DsM (Id, [PmGrd])
</span><a href="GHC.HsToCore.PmCheck.html#translateLPatV"><span class="hs-identifier hs-var">translateLPatV</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681144808"><span class="hs-identifier hs-var">fam_insts</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144807"><span class="hs-identifier hs-var">p</span></a></span><span>
</span><span id="line-687"></span><span>    </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmLet"><span class="hs-identifier hs-var">PmLet</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144802"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144803"><span class="hs-identifier hs-var">rhs</span></a></span><span> </span><span class="annot"><span class="annottext">PmGrd -&gt; [PmGrd] -&gt; [PmGrd]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[PmGrd]
</span><a href="#local-6989586621681144801"><span class="hs-identifier hs-var">grds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-688"></span><span>
</span><span id="line-689"></span><span class="hs-comment">-- | Translate a boolean guard</span><span>
</span><span id="line-690"></span><span class="hs-comment">--   @e ==&gt;  let x = e; True &lt;- x@</span><span>
</span><span id="line-691"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#translateBoolGuard"><span class="hs-identifier hs-type">translateBoolGuard</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdVec"><span class="hs-identifier hs-type">GrdVec</span></a></span><span>
</span><span id="line-692"></span><span id="translateBoolGuard"><span class="annot"><span class="annottext">translateBoolGuard :: LHsExpr (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
</span><a href="GHC.HsToCore.PmCheck.html#translateBoolGuard"><span class="hs-identifier hs-var hs-var">translateBoolGuard</span></a></span></span><span> </span><span id="local-6989586621681144800"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144800"><span class="hs-identifier hs-var">e</span></a></span></span><span>
</span><span id="line-693"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Maybe (CoreExpr -&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr) -&gt; Bool
forall a. Maybe a -&gt; Bool
</span><a href="../../base/src/Data.Maybe.html#isJust"><span class="hs-identifier hs-var">isJust</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; Maybe (CoreExpr -&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr)
</span><a href="GHC.HsToCore.Utils.html#isTrueLHsExpr"><span class="hs-identifier hs-var">isTrueLHsExpr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144800"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-694"></span><span>    </span><span class="hs-comment">-- The formal thing to do would be to generate (True &lt;- True)</span><span>
</span><span id="line-695"></span><span>    </span><span class="hs-comment">-- but it is trivial to solve so instead we give back an empty</span><span>
</span><span id="line-696"></span><span>    </span><span class="hs-comment">-- GrdVec for efficiency</span><span>
</span><span id="line-697"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
</span><a href="GHC.HsToCore.Expr.html#dsLExpr"><span class="hs-identifier hs-var">dsLExpr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144800"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
-&gt; (CoreExpr -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-glyph">case</span><span>
</span><span id="line-698"></span><span>      </span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621681144798"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144798"><span class="hs-identifier hs-var">y</span></a></span></span><span>
</span><span id="line-699"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Maybe DataCon
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Id -&gt; Maybe DataCon
</span><a href="GHC.Types.Id.html#isDataConId_maybe"><span class="hs-identifier hs-var">isDataConId_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144798"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-700"></span><span>        </span><span class="hs-comment">-- Omit the let by matching on y</span><span>
</span><span id="line-701"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id -&gt; DataCon -&gt; [Id] -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#vanillaConGrd"><span class="hs-identifier hs-var">vanillaConGrd</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144798"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#trueDataCon"><span class="hs-identifier hs-var">trueDataCon</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-702"></span><span>      </span><span id="local-6989586621681144797"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144797"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-703"></span><span>        </span><span id="local-6989586621681144796"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144796"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; DsM Id
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#mkPmId"><span class="hs-identifier hs-var">mkPmId</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#boolTy"><span class="hs-identifier hs-var">boolTy</span></a></span><span>
</span><span id="line-704"></span><span>        </span><span class="annot"><span class="annottext">[PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">([PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd])
-&gt; [PmGrd] -&gt; IOEnv (Env DsGblEnv DsLclEnv) [PmGrd]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#PmLet"><span class="hs-identifier hs-var">PmLet</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144796"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144797"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Id -&gt; DataCon -&gt; [Id] -&gt; PmGrd
</span><a href="GHC.HsToCore.PmCheck.html#vanillaConGrd"><span class="hs-identifier hs-var">vanillaConGrd</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144796"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#trueDataCon"><span class="hs-identifier hs-var">trueDataCon</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-705"></span><span>
</span><span id="line-706"></span><span class="hs-comment">{- Note [Field match order for RecCon]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The order for RecCon field patterns actually determines evaluation order of
the pattern match. For example:

  data T = T { a :: !Bool, b :: Char, c :: Int }
  f :: T -&gt; ()
  f T{ c = 42, b = 'b' } = ()

Then
  * @f (T (error &quot;a&quot;) (error &quot;b&quot;) (error &quot;c&quot;))@ errors out with &quot;a&quot; because of
    the strict field.
  * @f (T True        (error &quot;b&quot;) (error &quot;c&quot;))@ errors out with &quot;c&quot; because it
    is mentioned frist in the pattern match.

This means we can't just desugar the pattern match to the PatVec
@[T !_ 'b' 42]@. Instead we have to generate variable matches that have
strictness according to the field declarations and afterwards force them in the
right order. As a result, we get the PatVec @[T !_ b c, 42 &lt;- c, 'b' &lt;- b]@.

Of course, when the labels occur in the order they are defined, we can just use
the simpler desugaring.

Note [Order of guards matters]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Similar to Note [Field match order for RecCon], the order in which the guards
for a pattern match appear matter. Consider a situation similar to T5117:

  f (0:_)  = ()
  f (0:[]) = ()

The latter clause is clearly redundant. Yet if we translate the second clause as

  [x:xs' &lt;- xs, [] &lt;- xs', 0 &lt;- x]

We will say that the second clause only has an inaccessible RHS. That's because
we force the tail of the list before comparing its head! So the correct
translation would have been

  [x:xs' &lt;- xs, 0 &lt;- x, [] &lt;- xs']

And we have to take in the guards on list cells into @mkListGrds@.

Note [Countering exponential blowup]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Precise pattern match exhaustiveness checking is necessarily exponential in
the size of some input programs. We implement a counter-measure in the form of
the -fmax-pmcheck-models flag, limiting the number of Deltas we check against
each pattern by a constant.

How do we do that? Consider

  f True True = ()
  f True True = ()

And imagine we set our limit to 1 for the sake of the example. The first clause
will be checked against the initial Delta, {}. Doing so will produce an
Uncovered set of size 2, containing the models {x/~True} and {x~True,y/~True}.
Also we find the first clause to cover the model {x~True,y~True}.

But the Uncovered set we get out of the match is too huge! We somehow have to
ensure not to make things worse as they are already, so we continue checking
with a singleton Uncovered set of the initial Delta {}. Why is this
sound (wrt. notion of the GADTs Meet their Match paper)? Well, it basically
amounts to forgetting that we matched against the first clause. The values
represented by {} are a superset of those represented by its two refinements
{x/~True} and {x~True,y/~True}.

This forgetfulness becomes very apparent in the example above: By continuing
with {} we don't detect the second clause as redundant, as it again covers the
same non-empty subset of {}. So we don't flag everything as redundant anymore,
but still will never flag something as redundant that isn't.

For exhaustivity, the converse applies: We will report @f@ as non-exhaustive
and report @f _ _@ as missing, which is a superset of the actual missing
matches. But soundness means we will never fail to report a missing match.

This mechanism is implemented in 'throttle'.

Guards are an extreme example in this regard, with #11195 being a particularly
dreadful example: Since their RHS are often pretty much unique, we split on a
variable (the one representing the RHS) that doesn't occur anywhere else in the
program, so we don't actually get useful information out of that split!

Note [Translate CoPats]
~~~~~~~~~~~~~~~~~~~~~~~
The pattern match checker did not know how to handle coerced patterns `CoPat`
efficiently, which gave rise to #11276. The original approach translated
`CoPat`s:

    pat |&gt; co    ===&gt;    x (pat &lt;- (x |&gt; co))

Why did we do this seemingly unnecessary expansion in the first place?
The reason is that the type of @pat |&gt; co@ (which is the type of the value
abstraction we match against) might be different than that of @pat@. Data
instances such as @Sing (a :: Bool)@ are a good example of this: If we would
just drop the coercion, we'd get a type error when matching @pat@ against its
value abstraction, with the result being that pmIsSatisfiable decides that every
possible data constructor fitting @pat@ is rejected as uninhabitated, leading to
a lot of false warnings.

But we can check whether the coercion is a hole or if it is just refl, in
which case we can drop it.

%************************************************************************
%*                                                                      *
                 Utilities for Pattern Match Checking
%*                                                                      *
%************************************************************************
-}</span><span>
</span><span id="line-816"></span><span>
</span><span id="line-817"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-818"></span><span class="hs-comment">-- * Basic utilities</span><span>
</span><span id="line-819"></span><span>
</span><span id="line-820"></span><span class="hs-comment">{-
Note [Extensions to GADTs Meet Their Match]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The GADTs Meet Their Match paper presents the formalism that GHC's coverage
checker adheres to. Since the paper's publication, there have been some
additional features added to the coverage checker which are not described in
the paper. This Note serves as a reference for these new features.

* Value abstractions are severely simplified to the point where they are just
  variables. The information about the shape of a variable is encoded in
  the oracle state 'Delta' instead.
* Handling of uninhabited fields like `!Void`.
  See Note [Strict argument type constraints] in GHC.HsToCore.PmCheck.Oracle.
* Efficient handling of literal splitting, large enumerations and accurate
  redundancy warnings for `COMPLETE` groups through the oracle.

Note [Filtering out non-matching COMPLETE sets]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Currently, conlikes in a COMPLETE set are simply grouped by the
type constructor heading the return type. This is nice and simple, but it does
mean that there are scenarios when a COMPLETE set might be incompatible with
the type of a scrutinee. For instance, consider (from #14135):

  data Foo a = Foo1 a | Foo2 a

  pattern MyFoo2 :: Int -&gt; Foo Int
  pattern MyFoo2 i = Foo2 i

  {-# COMPLETE Foo1, MyFoo2 #-}

  f :: Foo a -&gt; a
  f (Foo1 x) = x

`f` has an incomplete pattern-match, so when choosing which constructors to
report as unmatched in a warning, GHC must choose between the original set of
data constructors {Foo1, Foo2} and the COMPLETE set {Foo1, MyFoo2}. But observe
that GHC shouldn't even consider the COMPLETE set as a possibility: the return
type of MyFoo2, Foo Int, does not match the type of the scrutinee, Foo a, since
there's no substitution `s` such that s(Foo Int) = Foo a.

To ensure that GHC doesn't pick this COMPLETE set, it checks each pattern
synonym constructor's return type matches the type of the scrutinee, and if one
doesn't, then we remove the whole COMPLETE set from consideration.

One might wonder why GHC only checks /pattern synonym/ constructors, and not
/data/ constructors as well. The reason is because that the type of a
GADT constructor very well may not match the type of a scrutinee, and that's
OK. Consider this example (from #14059):

  data SBool (z :: Bool) where
    SFalse :: SBool False
    STrue  :: SBool True

  pattern STooGoodToBeTrue :: forall (z :: Bool). ()
                           =&gt; z ~ True
                           =&gt; SBool z
  pattern STooGoodToBeTrue = STrue
  {-# COMPLETE SFalse, STooGoodToBeTrue #-}

  wobble :: SBool z -&gt; Bool
  wobble STooGoodToBeTrue = True

In the incomplete pattern match for `wobble`, we /do/ want to warn that SFalse
should be matched against, even though its type, SBool False, does not match
the scrutinee type, SBool z.

SG: Another angle at this is that the implied constraints when we instantiate
universal type variables in the return type of a GADT will lead to *provided*
thetas, whereas when we instantiate the return type of a pattern synonym that
corresponds to a *required* theta. See Note [Pattern synonym result type] in
PatSyn. Note how isValidCompleteMatches will successfully filter out

    pattern Just42 :: Maybe Int
    pattern Just42 = Just 42

But fail to filter out the equivalent

    pattern Just'42 :: (a ~ Int) =&gt; Maybe a
    pattern Just'42 = Just 42

Which seems fine as far as tcMatchTy is concerned, but it raises a few eye
brows.
-}</span><span>
</span><span id="line-903"></span><span>
</span><span id="line-904"></span><span class="hs-comment">{-
%************************************************************************
%*                                                                      *
            Heart of the algorithm: checkGrdTree
%*                                                                      *
%************************************************************************
-}</span><span>
</span><span id="line-911"></span><span>
</span><span id="line-912"></span><span class="hs-comment">-- | @throttle limit old new@ returns @old@ if the number of 'Delta's in @new@</span><span>
</span><span id="line-913"></span><span class="hs-comment">-- is exceeding the given @limit@ and the @old@ number of 'Delta's.</span><span>
</span><span id="line-914"></span><span class="hs-comment">-- See Note [Countering exponential blowup].</span><span>
</span><span id="line-915"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#throttle"><span class="hs-identifier hs-type">throttle</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Precision"><span class="hs-identifier hs-type">Precision</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-916"></span><span id="throttle"><span class="annot"><span class="annottext">throttle :: Int -&gt; Deltas -&gt; Deltas -&gt; (Precision, Deltas)
</span><a href="GHC.HsToCore.PmCheck.html#throttle"><span class="hs-identifier hs-var hs-var">throttle</span></a></span></span><span> </span><span id="local-6989586621681144794"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144794"><span class="hs-identifier hs-var">limit</span></a></span></span><span> </span><span id="local-6989586621681144793"><span class="annot"><span class="annottext">old :: Deltas
</span><a href="#local-6989586621681144793"><span class="hs-identifier hs-var">old</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#MkDeltas"><span class="hs-identifier hs-type">MkDeltas</span></a></span><span> </span><span id="local-6989586621681144792"><span class="annot"><span class="annottext">Bag Delta
</span><a href="#local-6989586621681144792"><span class="hs-identifier hs-var">old_ds</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144791"><span class="annot"><span class="annottext">new :: Deltas
</span><a href="#local-6989586621681144791"><span class="hs-identifier hs-var">new</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#MkDeltas"><span class="hs-identifier hs-type">MkDeltas</span></a></span><span> </span><span id="local-6989586621681144790"><span class="annot"><span class="annottext">Bag Delta
</span><a href="#local-6989586621681144790"><span class="hs-identifier hs-var">new_ds</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-917"></span><span>  </span><span class="hs-comment">--- | pprTrace &quot;PmCheck:throttle&quot; (ppr (length old_ds) &lt;+&gt; ppr (length new_ds) &lt;+&gt; ppr limit) False = undefined</span><span>
</span><span id="line-918"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bag Delta -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Delta
</span><a href="#local-6989586621681144790"><span class="hs-identifier hs-var">new_ds</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier hs-var">max</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144794"><span class="hs-identifier hs-var">limit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag Delta -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Delta
</span><a href="#local-6989586621681144792"><span class="hs-identifier hs-var">old_ds</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Approximate"><span class="hs-identifier hs-var">Approximate</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144793"><span class="hs-identifier hs-var">old</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-919"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                                 </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Precise"><span class="hs-identifier hs-var">Precise</span></a></span><span class="hs-special">,</span><span>     </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144791"><span class="hs-identifier hs-var">new</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-920"></span><span>
</span><span id="line-921"></span><span class="hs-comment">-- | Matching on a newtype doesn't force anything.</span><span>
</span><span id="line-922"></span><span class="hs-comment">-- See Note [Divergence of Newtype matches] in &quot;GHC.HsToCore.PmCheck.Oracle&quot;.</span><span>
</span><span id="line-923"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#conMatchForces"><span class="hs-identifier hs-type">conMatchForces</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#PmAltCon"><span class="hs-identifier hs-type">PmAltCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-924"></span><span id="conMatchForces"><span class="annot"><span class="annottext">conMatchForces :: PmAltCon -&gt; Bool
</span><a href="GHC.HsToCore.PmCheck.html#conMatchForces"><span class="hs-identifier hs-var hs-var">conMatchForces</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#PmAltConLike"><span class="hs-identifier hs-type">PmAltConLike</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.ConLike.html#RealDataCon"><span class="hs-identifier hs-type">RealDataCon</span></a></span><span> </span><span id="local-6989586621681144786"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681144786"><span class="hs-identifier hs-var">dc</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-925"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isNewTyCon"><span class="hs-identifier hs-var">isNewTyCon</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; TyCon
</span><a href="GHC.Core.DataCon.html#dataConTyCon"><span class="hs-identifier hs-var">dataConTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621681144786"><span class="hs-identifier hs-var">dc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-926"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#conMatchForces"><span class="hs-identifier hs-var">conMatchForces</span></a></span><span> </span><span class="annot"><span class="annottext">PmAltCon
</span><span class="hs-identifier">_</span></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-927"></span><span>
</span><span id="line-928"></span><span class="hs-comment">-- | Makes sure that we only wrap a single 'MayDiverge' around an</span><span>
</span><span id="line-929"></span><span class="hs-comment">-- 'AnnotatedTree', purely for esthetic reasons.</span><span>
</span><span id="line-930"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#mayDiverge"><span class="hs-identifier hs-type">mayDiverge</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AnnotatedTree"><span class="hs-identifier hs-type">AnnotatedTree</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AnnotatedTree"><span class="hs-identifier hs-type">AnnotatedTree</span></a></span><span>
</span><span id="line-931"></span><span id="mayDiverge"><span class="annot"><span class="annottext">mayDiverge :: AnnotatedTree -&gt; AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#mayDiverge"><span class="hs-identifier hs-var hs-var">mayDiverge</span></a></span></span><span> </span><span id="local-6989586621681144782"><span class="annot"><span class="annottext">a :: AnnotatedTree
</span><a href="#local-6989586621681144782"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#MayDiverge"><span class="hs-identifier hs-type">MayDiverge</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144782"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-932"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#mayDiverge"><span class="hs-identifier hs-var">mayDiverge</span></a></span><span> </span><span id="local-6989586621681144781"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144781"><span class="hs-identifier hs-var">a</span></a></span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#MayDiverge"><span class="hs-identifier hs-var">MayDiverge</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144781"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-933"></span><span>
</span><span id="line-934"></span><span class="hs-comment">-- | Computes two things:</span><span>
</span><span id="line-935"></span><span class="hs-comment">--</span><span>
</span><span id="line-936"></span><span class="hs-comment">--   * The set of uncovered values not matched by any of the clauses of the</span><span>
</span><span id="line-937"></span><span class="hs-comment">--     'GrdTree'. Note that 'PmCon' guards are the only way in which values</span><span>
</span><span id="line-938"></span><span class="hs-comment">--     fall through from one 'Many' branch to the next.</span><span>
</span><span id="line-939"></span><span class="hs-comment">--   * An 'AnnotatedTree' that contains divergence and inaccessibility info</span><span>
</span><span id="line-940"></span><span class="hs-comment">--     for all clauses. Will be fed to 'redundantAndInaccessibleRhss' for</span><span>
</span><span id="line-941"></span><span class="hs-comment">--     presenting redundant and proper innaccessible RHSs to the user.</span><span>
</span><span id="line-942"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-type">checkGrdTree'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-type">GrdTree</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span>
</span><span id="line-943"></span><span class="hs-comment">-- RHS: Check that it covers something and wrap Inaccessible if not</span><span>
</span><span id="line-944"></span><span id="checkGrdTree%27"><span class="annot"><span class="annottext">checkGrdTree' :: GrdTree -&gt; Deltas -&gt; DsM CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var hs-var">checkGrdTree'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Rhs"><span class="hs-identifier hs-type">Rhs</span></a></span><span> </span><span id="local-6989586621681144779"><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681144779"><span class="hs-identifier hs-var">sdoc</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144778"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144778"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-945"></span><span>  </span><span id="local-6989586621681144777"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144777"><span class="hs-identifier hs-var">is_covered</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; DsM Bool
</span><a href="GHC.HsToCore.PmCheck.html#isInhabited"><span class="hs-identifier hs-var">isInhabited</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144778"><span class="hs-identifier hs-var">deltas</span></a></span><span>
</span><span id="line-946"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144776"><span class="annot"><span class="annottext">clauses :: AnnotatedTree
</span><a href="#local-6989586621681144776"><span class="hs-identifier hs-var hs-var">clauses</span></a></span></span><span>
</span><span id="line-947"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144777"><span class="hs-identifier hs-var">is_covered</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; RhsInfo -&gt; AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#AccessibleRhs"><span class="hs-identifier hs-var">AccessibleRhs</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144778"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681144779"><span class="hs-identifier hs-var">sdoc</span></a></span><span>
</span><span id="line-948"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RhsInfo -&gt; AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#InaccessibleRhs"><span class="hs-identifier hs-var">InaccessibleRhs</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681144779"><span class="hs-identifier hs-var">sdoc</span></a></span><span>
</span><span id="line-949"></span><span>  </span><span class="annot"><span class="annottext">CheckResult -&gt; DsM CheckResult
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">CheckResult :: AnnotatedTree -&gt; Deltas -&gt; Precision -&gt; CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span>
</span><span id="line-950"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cr_clauses :: AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#cr_clauses"><span class="hs-identifier hs-var">cr_clauses</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144776"><span class="hs-identifier hs-var">clauses</span></a></span><span>
</span><span id="line-951"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cr_uncov :: Deltas
</span><a href="GHC.HsToCore.PmCheck.html#cr_uncov"><span class="hs-identifier hs-var">cr_uncov</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bag Delta -&gt; Deltas
</span><a href="GHC.HsToCore.PmCheck.Types.html#MkDeltas"><span class="hs-identifier hs-var">MkDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Delta
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span>
</span><span id="line-952"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cr_approx :: Precision
</span><a href="GHC.HsToCore.PmCheck.html#cr_approx"><span class="hs-identifier hs-var">cr_approx</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Precise"><span class="hs-identifier hs-var">Precise</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-953"></span><span class="hs-comment">-- let x = e: Refine with x ~ e</span><span>
</span><span id="line-954"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var">checkGrdTree'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Guard"><span class="hs-identifier hs-type">Guard</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmLet"><span class="hs-identifier hs-type">PmLet</span></a></span><span> </span><span id="local-6989586621681144774"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144774"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681144773"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144773"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144772"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144772"><span class="hs-identifier hs-var">tree</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144771"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144771"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-955"></span><span>  </span><span id="local-6989586621681144770"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144770"><span class="hs-identifier hs-var">deltas'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; PmCt -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtDeltas"><span class="hs-identifier hs-var">addPmCtDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144771"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; PmCt
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#PmCoreCt"><span class="hs-identifier hs-var">PmCoreCt</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144774"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144773"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-956"></span><span>  </span><span class="annot"><span class="annottext">GrdTree -&gt; Deltas -&gt; DsM CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var">checkGrdTree'</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144772"><span class="hs-identifier hs-var">tree</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144770"><span class="hs-identifier hs-var">deltas'</span></a></span><span>
</span><span id="line-957"></span><span class="hs-comment">-- Bang x: Diverge on x ~ &#8869;, refine with x /~ &#8869;</span><span>
</span><span id="line-958"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var">checkGrdTree'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Guard"><span class="hs-identifier hs-type">Guard</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmBang"><span class="hs-identifier hs-type">PmBang</span></a></span><span> </span><span id="local-6989586621681144768"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144768"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144767"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144767"><span class="hs-identifier hs-var">tree</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144766"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144766"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-959"></span><span>  </span><span id="local-6989586621681144765"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144765"><span class="hs-identifier hs-var">has_diverged</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; PmCt -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtDeltas"><span class="hs-identifier hs-var">addPmCtDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144766"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; PmCt
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#PmBotCt"><span class="hs-identifier hs-var">PmBotCt</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144768"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DsM Deltas -&gt; (Deltas -&gt; DsM Bool) -&gt; DsM Bool
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; DsM Bool
</span><a href="GHC.HsToCore.PmCheck.html#isInhabited"><span class="hs-identifier hs-var">isInhabited</span></a></span><span>
</span><span id="line-960"></span><span>  </span><span id="local-6989586621681144763"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144763"><span class="hs-identifier hs-var">deltas'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; PmCt -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtDeltas"><span class="hs-identifier hs-var">addPmCtDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144766"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; PmCt
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#PmNotBotCt"><span class="hs-identifier hs-var">PmNotBotCt</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144768"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-961"></span><span>  </span><span id="local-6989586621681144762"><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681144762"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; Deltas -&gt; DsM CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var">checkGrdTree'</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144767"><span class="hs-identifier hs-var">tree</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144763"><span class="hs-identifier hs-var">deltas'</span></a></span><span>
</span><span id="line-962"></span><span>  </span><span class="annot"><span class="annottext">CheckResult -&gt; DsM CheckResult
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681144762"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cr_clauses :: AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#cr_clauses"><span class="hs-identifier hs-var">cr_clauses</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; (AnnotatedTree -&gt; AnnotatedTree)
-&gt; AnnotatedTree
-&gt; AnnotatedTree
forall a. Bool -&gt; (a -&gt; a) -&gt; a -&gt; a
</span><a href="GHC.Utils.Misc.html#applyWhen"><span class="hs-identifier hs-var">applyWhen</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144765"><span class="hs-identifier hs-var">has_diverged</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#mayDiverge"><span class="hs-identifier hs-var">mayDiverge</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CheckResult -&gt; AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#cr_clauses"><span class="hs-identifier hs-var hs-var">cr_clauses</span></a></span><span> </span><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681144762"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-963"></span><span class="hs-comment">-- Con: Diverge on x ~ &#8869;, fall through on x /~ K and refine with x ~ K ys</span><span>
</span><span id="line-964"></span><span class="hs-comment">--      and type info</span><span>
</span><span id="line-965"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var">checkGrdTree'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Guard"><span class="hs-identifier hs-type">Guard</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#PmCon"><span class="hs-identifier hs-type">PmCon</span></a></span><span> </span><span id="local-6989586621681144760"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144760"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681144759"><span class="annot"><span class="annottext">PmAltCon
</span><a href="#local-6989586621681144759"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span id="local-6989586621681144758"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144758"><span class="hs-identifier hs-var">tvs</span></a></span></span><span> </span><span id="local-6989586621681144757"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144757"><span class="hs-identifier hs-var">dicts</span></a></span></span><span> </span><span id="local-6989586621681144756"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144756"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144755"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144755"><span class="hs-identifier hs-var">tree</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144754"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144754"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-966"></span><span>  </span><span id="local-6989586621681144753"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144753"><span class="hs-identifier hs-var">has_diverged</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-967"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">PmAltCon -&gt; Bool
</span><a href="GHC.HsToCore.PmCheck.html#conMatchForces"><span class="hs-identifier hs-var">conMatchForces</span></a></span><span> </span><span class="annot"><span class="annottext">PmAltCon
</span><a href="#local-6989586621681144759"><span class="hs-identifier hs-var">con</span></a></span><span>
</span><span id="line-968"></span><span>      </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; PmCt -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtDeltas"><span class="hs-identifier hs-var">addPmCtDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144754"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; PmCt
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#PmBotCt"><span class="hs-identifier hs-var">PmBotCt</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144760"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DsM Deltas -&gt; (Deltas -&gt; DsM Bool) -&gt; DsM Bool
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; DsM Bool
</span><a href="GHC.HsToCore.PmCheck.html#isInhabited"><span class="hs-identifier hs-var">isInhabited</span></a></span><span>
</span><span id="line-969"></span><span>      </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; DsM Bool
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-970"></span><span>  </span><span id="local-6989586621681144752"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144752"><span class="hs-identifier hs-var">unc_this</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; PmCt -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtDeltas"><span class="hs-identifier hs-var">addPmCtDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144754"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; PmAltCon -&gt; PmCt
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#PmNotConCt"><span class="hs-identifier hs-var">PmNotConCt</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144760"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">PmAltCon
</span><a href="#local-6989586621681144759"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-971"></span><span>  </span><span id="local-6989586621681144750"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144750"><span class="hs-identifier hs-var">deltas'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; PmCts -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtsDeltas"><span class="hs-identifier hs-var">addPmCtsDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144754"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="annot"><span class="annottext">(PmCts -&gt; DsM Deltas) -&gt; PmCts -&gt; DsM Deltas
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-972"></span><span>    </span><span class="annot"><span class="annottext">[PmCt] -&gt; PmCts
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; PmCt
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#PmTyCt"><span class="hs-identifier hs-var">PmTyCt</span></a></span><span> </span><span class="annot"><span class="annottext">(Type -&gt; PmCt) -&gt; (Id -&gt; Type) -&gt; Id -&gt; PmCt
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#evVarPred"><span class="hs-identifier hs-var">evVarPred</span></a></span><span> </span><span class="annot"><span class="annottext">(Id -&gt; PmCt) -&gt; [Id] -&gt; [PmCt]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144757"><span class="hs-identifier hs-var">dicts</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PmCts -&gt; PmCt -&gt; PmCts
forall a. Bag a -&gt; a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#snocBag"><span class="hs-operator hs-var">`snocBag`</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; PmAltCon -&gt; [Id] -&gt; [Id] -&gt; PmCt
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#PmConCt"><span class="hs-identifier hs-var">PmConCt</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144760"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">PmAltCon
</span><a href="#local-6989586621681144759"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144758"><span class="hs-identifier hs-var">tvs</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144756"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-973"></span><span>  </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span> </span><span id="local-6989586621681144745"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144745"><span class="hs-identifier hs-var">tree'</span></a></span></span><span> </span><span id="local-6989586621681144744"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144744"><span class="hs-identifier hs-var">unc_inner</span></a></span></span><span> </span><span id="local-6989586621681144743"><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681144743"><span class="hs-identifier hs-var">prec</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; Deltas -&gt; DsM CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var">checkGrdTree'</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144755"><span class="hs-identifier hs-var">tree</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144750"><span class="hs-identifier hs-var">deltas'</span></a></span><span>
</span><span id="line-974"></span><span>  </span><span id="local-6989586621681144742"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144742"><span class="hs-identifier hs-var">limit</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Int
</span><a href="GHC.Driver.Session.html#maxPmCheckModels"><span class="hs-identifier hs-var hs-var">maxPmCheckModels</span></a></span><span> </span><span class="annot"><span class="annottext">(DynFlags -&gt; Int)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) DynFlags
-&gt; IOEnv (Env DsGblEnv DsLclEnv) Int
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-975"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681144740"><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681144740"><span class="hs-identifier hs-var">prec'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144739"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144739"><span class="hs-identifier hs-var">unc'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Deltas -&gt; Deltas -&gt; (Precision, Deltas)
</span><a href="GHC.HsToCore.PmCheck.html#throttle"><span class="hs-identifier hs-var">throttle</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144742"><span class="hs-identifier hs-var">limit</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144754"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144752"><span class="hs-identifier hs-var">unc_this</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; Deltas -&gt; Deltas
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">Semi.&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144744"><span class="hs-identifier hs-var">unc_inner</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-976"></span><span>  </span><span class="annot"><span class="annottext">CheckResult -&gt; DsM CheckResult
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">CheckResult :: AnnotatedTree -&gt; Deltas -&gt; Precision -&gt; CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span>
</span><span id="line-977"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cr_clauses :: AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#cr_clauses"><span class="hs-identifier hs-var">cr_clauses</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; (AnnotatedTree -&gt; AnnotatedTree)
-&gt; AnnotatedTree
-&gt; AnnotatedTree
forall a. Bool -&gt; (a -&gt; a) -&gt; a -&gt; a
</span><a href="GHC.Utils.Misc.html#applyWhen"><span class="hs-identifier hs-var">applyWhen</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144753"><span class="hs-identifier hs-var">has_diverged</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#mayDiverge"><span class="hs-identifier hs-var">mayDiverge</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144745"><span class="hs-identifier hs-var">tree'</span></a></span><span>
</span><span id="line-978"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cr_uncov :: Deltas
</span><a href="GHC.HsToCore.PmCheck.html#cr_uncov"><span class="hs-identifier hs-var">cr_uncov</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144739"><span class="hs-identifier hs-var">unc'</span></a></span><span>
</span><span id="line-979"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cr_approx :: Precision
</span><a href="GHC.HsToCore.PmCheck.html#cr_approx"><span class="hs-identifier hs-var">cr_approx</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681144743"><span class="hs-identifier hs-var">prec</span></a></span><span> </span><span class="annot"><span class="annottext">Precision -&gt; Precision -&gt; Precision
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">Semi.&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681144740"><span class="hs-identifier hs-var">prec'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-980"></span><span class="hs-comment">-- Sequence: Thread residual uncovered sets from equation to equation</span><span>
</span><span id="line-981"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var">checkGrdTree'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#Sequence"><span class="hs-identifier hs-type">Sequence</span></a></span><span> </span><span id="local-6989586621681144738"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144738"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681144737"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144737"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144736"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144736"><span class="hs-identifier hs-var">unc_0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-982"></span><span>  </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span> </span><span id="local-6989586621681144735"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144735"><span class="hs-identifier hs-var">l'</span></a></span></span><span> </span><span id="local-6989586621681144734"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144734"><span class="hs-identifier hs-var">unc_1</span></a></span></span><span> </span><span id="local-6989586621681144733"><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681144733"><span class="hs-identifier hs-var">prec_l</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; Deltas -&gt; DsM CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var">checkGrdTree'</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144738"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144736"><span class="hs-identifier hs-var">unc_0</span></a></span><span>
</span><span id="line-983"></span><span>  </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span> </span><span id="local-6989586621681144732"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144732"><span class="hs-identifier hs-var">r'</span></a></span></span><span> </span><span id="local-6989586621681144731"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144731"><span class="hs-identifier hs-var">unc_2</span></a></span></span><span> </span><span id="local-6989586621681144730"><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681144730"><span class="hs-identifier hs-var">prec_r</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; Deltas -&gt; DsM CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var">checkGrdTree'</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144737"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144734"><span class="hs-identifier hs-var">unc_1</span></a></span><span>
</span><span id="line-984"></span><span>  </span><span class="annot"><span class="annottext">CheckResult -&gt; DsM CheckResult
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">CheckResult :: AnnotatedTree -&gt; Deltas -&gt; Precision -&gt; CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span>
</span><span id="line-985"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cr_clauses :: AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#cr_clauses"><span class="hs-identifier hs-var">cr_clauses</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; AnnotatedTree -&gt; AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#SequenceAnn"><span class="hs-identifier hs-var">SequenceAnn</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144735"><span class="hs-identifier hs-var">l'</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144732"><span class="hs-identifier hs-var">r'</span></a></span><span>
</span><span id="line-986"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cr_uncov :: Deltas
</span><a href="GHC.HsToCore.PmCheck.html#cr_uncov"><span class="hs-identifier hs-var">cr_uncov</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144731"><span class="hs-identifier hs-var">unc_2</span></a></span><span>
</span><span id="line-987"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cr_approx :: Precision
</span><a href="GHC.HsToCore.PmCheck.html#cr_approx"><span class="hs-identifier hs-var">cr_approx</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681144733"><span class="hs-identifier hs-var">prec_l</span></a></span><span> </span><span class="annot"><span class="annottext">Precision -&gt; Precision -&gt; Precision
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">Semi.&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681144730"><span class="hs-identifier hs-var">prec_r</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-988"></span><span class="hs-comment">-- Empty: Fall through for all values</span><span>
</span><span id="line-989"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var">checkGrdTree'</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="GHC.HsToCore.PmCheck.html#Empty"><span class="hs-identifier hs-var">Empty</span></a></span><span> </span><span id="local-6989586621681144729"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144729"><span class="hs-identifier hs-var">unc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-990"></span><span>  </span><span class="annot"><span class="annottext">CheckResult -&gt; DsM CheckResult
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">CheckResult :: AnnotatedTree -&gt; Deltas -&gt; Precision -&gt; CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span>
</span><span id="line-991"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cr_clauses :: AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#cr_clauses"><span class="hs-identifier hs-var">cr_clauses</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#EmptyAnn"><span class="hs-identifier hs-var">EmptyAnn</span></a></span><span>
</span><span id="line-992"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cr_uncov :: Deltas
</span><a href="GHC.HsToCore.PmCheck.html#cr_uncov"><span class="hs-identifier hs-var">cr_uncov</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144729"><span class="hs-identifier hs-var">unc</span></a></span><span>
</span><span id="line-993"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cr_approx :: Precision
</span><a href="GHC.HsToCore.PmCheck.html#cr_approx"><span class="hs-identifier hs-var">cr_approx</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Precise"><span class="hs-identifier hs-var">Precise</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-994"></span><span>
</span><span id="line-995"></span><span class="hs-comment">-- | Print diagnostic info and actually call 'checkGrdTree''.</span><span>
</span><span id="line-996"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#checkGrdTree"><span class="hs-identifier hs-type">checkGrdTree</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#GrdTree"><span class="hs-identifier hs-type">GrdTree</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span>
</span><span id="line-997"></span><span id="checkGrdTree"><span class="annot"><span class="annottext">checkGrdTree :: GrdTree -&gt; Deltas -&gt; DsM CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#checkGrdTree"><span class="hs-identifier hs-var hs-var">checkGrdTree</span></a></span></span><span> </span><span id="local-6989586621681144728"><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144728"><span class="hs-identifier hs-var">guards</span></a></span></span><span> </span><span id="local-6989586621681144727"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144727"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-998"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#tracePm"><span class="hs-identifier hs-var">tracePm</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;checkGrdTree {&quot;</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; DsM ()) -&gt; SDoc -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144728"><span class="hs-identifier hs-var">guards</span></a></span><span>
</span><span id="line-999"></span><span>                                  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144727"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1000"></span><span>  </span><span id="local-6989586621681144726"><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681144726"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">GrdTree -&gt; Deltas -&gt; DsM CheckResult
</span><a href="GHC.HsToCore.PmCheck.html#checkGrdTree%27"><span class="hs-identifier hs-var">checkGrdTree'</span></a></span><span> </span><span class="annot"><span class="annottext">GrdTree
</span><a href="#local-6989586621681144728"><span class="hs-identifier hs-var">guards</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144727"><span class="hs-identifier hs-var">deltas</span></a></span><span>
</span><span id="line-1001"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#tracePm"><span class="hs-identifier hs-var">tracePm</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;checkGrdTree }:&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CheckResult -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681144726"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- braces are easier to match by tooling</span><span>
</span><span id="line-1002"></span><span>  </span><span class="annot"><span class="annottext">CheckResult -&gt; DsM CheckResult
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681144726"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1003"></span><span>
</span><span id="line-1004"></span><span class="hs-comment">-- ----------------------------------------------------------------------------</span><span>
</span><span id="line-1005"></span><span class="hs-comment">-- * Propagation of term constraints inwards when checking nested matches</span><span>
</span><span id="line-1006"></span><span>
</span><span id="line-1007"></span><span class="hs-comment">{- Note [Type and Term Equality Propagation]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When checking a match it would be great to have all type and term information
available so we can get more precise results. For this reason we have functions
`addDictsDs' and `addTmVarCsDs' in GHC.HsToCore.Monad that store in the
environment type and term constraints (respectively) as we go deeper.

The type constraints we propagate inwards are collected by `collectEvVarsPats'
in GHC.Hs.Pat. This handles bug #4139 ( see example
  https://gitlab.haskell.org/ghc/ghc/snippets/672 )
where this is needed.

For term equalities we do less, we just generate equalities for HsCase. For
example we accurately give 2 redundancy warnings for the marked cases:

f :: [a] -&gt; Bool
f x = case x of

  []    -&gt; case x of        -- brings (x ~ []) in scope
             []    -&gt; True
             (_:_) -&gt; False -- can't happen

  (_:_) -&gt; case x of        -- brings (x ~ (_:_)) in scope
             (_:_) -&gt; True
             []    -&gt; False -- can't happen

Functions `addScrutTmCs' is responsible for generating
these constraints.
-}</span><span>
</span><span id="line-1036"></span><span>
</span><span id="line-1037"></span><span class="hs-comment">-- | Locally update 'dsl_deltas' with the given action, but defer evaluation</span><span>
</span><span id="line-1038"></span><span class="hs-comment">-- with 'unsafeInterleaveM' in order not to do unnecessary work.</span><span>
</span><span id="line-1039"></span><span id="local-6989586621681145683"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#locallyExtendPmDelta"><span class="hs-identifier hs-type">locallyExtendPmDelta</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681145683"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681145683"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1040"></span><span id="locallyExtendPmDelta"><span class="annot"><span class="annottext">locallyExtendPmDelta :: forall a. (Deltas -&gt; DsM Deltas) -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.PmCheck.html#locallyExtendPmDelta"><span class="hs-identifier hs-var hs-var">locallyExtendPmDelta</span></a></span></span><span> </span><span id="local-6989586621681144718"><span class="annot"><span class="annottext">Deltas -&gt; DsM Deltas
</span><a href="#local-6989586621681144718"><span class="hs-identifier hs-var">ext</span></a></span></span><span> </span><span id="local-6989586621681144717"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681144717"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1041"></span><span>  </span><span id="local-6989586621681144716"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144716"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM Deltas
</span><a href="GHC.HsToCore.Monad.html#getPmDeltas"><span class="hs-identifier hs-var">getPmDeltas</span></a></span><span>
</span><span id="line-1042"></span><span>  </span><span id="local-6989586621681144715"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144715"><span class="hs-identifier hs-var">deltas'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DsM Deltas -&gt; DsM Deltas
forall env a. IOEnv env a -&gt; IOEnv env a
</span><a href="GHC.Data.IOEnv.html#unsafeInterleaveM"><span class="hs-identifier hs-var">unsafeInterleaveM</span></a></span><span> </span><span class="annot"><span class="annottext">(DsM Deltas -&gt; DsM Deltas) -&gt; DsM Deltas -&gt; DsM Deltas
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1043"></span><span>    </span><span id="local-6989586621681144714"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144714"><span class="hs-identifier hs-var">deltas'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; DsM Deltas
</span><a href="#local-6989586621681144718"><span class="hs-identifier hs-var">ext</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144716"><span class="hs-identifier hs-var">deltas</span></a></span><span>
</span><span id="line-1044"></span><span>    </span><span id="local-6989586621681144713"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144713"><span class="hs-identifier hs-var">inh</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; DsM Bool
</span><a href="GHC.HsToCore.PmCheck.html#isInhabited"><span class="hs-identifier hs-var">isInhabited</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144714"><span class="hs-identifier hs-var">deltas'</span></a></span><span>
</span><span id="line-1045"></span><span>    </span><span class="hs-comment">-- If adding a constraint would lead to a contradiction, don't add it.</span><span>
</span><span id="line-1046"></span><span>    </span><span class="hs-comment">-- See @Note [Recovering from unsatisfiable pattern-matching constraints]@</span><span>
</span><span id="line-1047"></span><span>    </span><span class="hs-comment">-- for why this is done.</span><span>
</span><span id="line-1048"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144713"><span class="hs-identifier hs-var">inh</span></a></span><span>
</span><span id="line-1049"></span><span>      </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; DsM Deltas
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144714"><span class="hs-identifier hs-var">deltas'</span></a></span><span>
</span><span id="line-1050"></span><span>      </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; DsM Deltas
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144716"><span class="hs-identifier hs-var">deltas</span></a></span><span>
</span><span id="line-1051"></span><span>  </span><span class="annot"><span class="annottext">Deltas -&gt; DsM a -&gt; DsM a
forall a. Deltas -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#updPmDeltas"><span class="hs-identifier hs-var">updPmDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144715"><span class="hs-identifier hs-var">deltas'</span></a></span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681144717"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-1052"></span><span>
</span><span id="line-1053"></span><span class="hs-comment">-- | Add in-scope type constraints if the coverage checker might run and then</span><span>
</span><span id="line-1054"></span><span class="hs-comment">-- run the given action.</span><span>
</span><span id="line-1055"></span><span id="local-6989586621681145677"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#addTyCsDs"><span class="hs-identifier hs-type">addTyCsDs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Origin"><span class="hs-identifier hs-type">Origin</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#EvVar"><span class="hs-identifier hs-type">EvVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681145677"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681145677"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1056"></span><span id="addTyCsDs"><span class="annot"><span class="annottext">addTyCsDs :: forall a. Origin -&gt; Bag Id -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.PmCheck.html#addTyCsDs"><span class="hs-identifier hs-var hs-var">addTyCsDs</span></a></span></span><span> </span><span id="local-6989586621681144707"><span class="annot"><span class="annottext">Origin
</span><a href="#local-6989586621681144707"><span class="hs-identifier hs-var">origin</span></a></span></span><span> </span><span id="local-6989586621681144706"><span class="annot"><span class="annottext">Bag Id
</span><a href="#local-6989586621681144706"><span class="hs-identifier hs-var">ev_vars</span></a></span></span><span> </span><span id="local-6989586621681144705"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681144705"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1057"></span><span>  </span><span id="local-6989586621681144704"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144704"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env DsGblEnv DsLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-1058"></span><span>  </span><span class="annot"><span class="annottext">Bool -&gt; (DsM a -&gt; DsM a) -&gt; DsM a -&gt; DsM a
forall a. Bool -&gt; (a -&gt; a) -&gt; a -&gt; a
</span><a href="GHC.Utils.Misc.html#applyWhen"><span class="hs-identifier hs-var">applyWhen</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Origin -&gt; Bool
</span><a href="GHC.HsToCore.PmCheck.html#needToRunPmCheck"><span class="hs-identifier hs-var">needToRunPmCheck</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144704"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Origin
</span><a href="#local-6989586621681144707"><span class="hs-identifier hs-var">origin</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1059"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Deltas -&gt; DsM Deltas) -&gt; DsM a -&gt; DsM a
forall a. (Deltas -&gt; DsM Deltas) -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.PmCheck.html#locallyExtendPmDelta"><span class="hs-identifier hs-var">locallyExtendPmDelta</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681144702"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144702"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; PmCts -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtsDeltas"><span class="hs-identifier hs-var">addPmCtsDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144702"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; PmCt
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#PmTyCt"><span class="hs-identifier hs-var">PmTyCt</span></a></span><span> </span><span class="annot"><span class="annottext">(Type -&gt; PmCt) -&gt; (Id -&gt; Type) -&gt; Id -&gt; PmCt
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Type
</span><a href="GHC.Tc.Utils.TcType.html#evVarPred"><span class="hs-identifier hs-var">evVarPred</span></a></span><span> </span><span class="annot"><span class="annottext">(Id -&gt; PmCt) -&gt; Bag Id -&gt; PmCts
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Id
</span><a href="#local-6989586621681144706"><span class="hs-identifier hs-var">ev_vars</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1060"></span><span>            </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681144705"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1061"></span><span>
</span><span id="line-1062"></span><span class="hs-comment">-- | Add equalities for the scrutinee to the local 'DsM' environment when</span><span>
</span><span id="line-1063"></span><span class="hs-comment">-- checking a case expression:</span><span>
</span><span id="line-1064"></span><span class="hs-comment">--     case e of x { matches }</span><span>
</span><span id="line-1065"></span><span class="hs-comment">-- When checking matches we record that (x ~ e) where x is the initial</span><span>
</span><span id="line-1066"></span><span class="hs-comment">-- uncovered. All matches will have to satisfy this equality.</span><span>
</span><span id="line-1067"></span><span id="local-6989586621681145675"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#addScrutTmCs"><span class="hs-identifier hs-type">addScrutTmCs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681145675"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681145675"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1068"></span><span id="addScrutTmCs"><span class="annot"><span class="annottext">addScrutTmCs :: forall a.
Maybe (LHsExpr (GhcPass 'Typechecked)) -&gt; [Id] -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.PmCheck.html#addScrutTmCs"><span class="hs-identifier hs-var hs-var">addScrutTmCs</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe (LHsExpr (GhcPass 'Typechecked))
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>    </span><span class="annot"><span class="annottext">[Id]
</span><span class="hs-identifier">_</span></span><span>   </span><span id="local-6989586621681144700"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681144700"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681144700"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-1069"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#addScrutTmCs"><span class="hs-identifier hs-var">addScrutTmCs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681144699"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144699"><span class="hs-identifier hs-var">scr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681144698"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144698"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">]</span><span> </span><span id="local-6989586621681144697"><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681144697"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1070"></span><span>  </span><span id="local-6989586621681144696"><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144696"><span class="hs-identifier hs-var">scr_e</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
-&gt; IOEnv (Env DsGblEnv DsLclEnv) CoreExpr
</span><a href="GHC.HsToCore.Expr.html#dsLExpr"><span class="hs-identifier hs-var">dsLExpr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681144699"><span class="hs-identifier hs-var">scr</span></a></span><span>
</span><span id="line-1071"></span><span>  </span><span class="annot"><span class="annottext">(Deltas -&gt; DsM Deltas) -&gt; DsM a -&gt; DsM a
forall a. (Deltas -&gt; DsM Deltas) -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.PmCheck.html#locallyExtendPmDelta"><span class="hs-identifier hs-var">locallyExtendPmDelta</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681144695"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144695"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Deltas -&gt; PmCts -&gt; DsM Deltas
</span><a href="GHC.HsToCore.PmCheck.html#addPmCtsDeltas"><span class="hs-identifier hs-var">addPmCtsDeltas</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144695"><span class="hs-identifier hs-var">deltas</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PmCt -&gt; PmCts
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Id -&gt; CoreExpr -&gt; PmCt
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#PmCoreCt"><span class="hs-identifier hs-var">PmCoreCt</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681144698"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">CoreExpr
</span><a href="#local-6989586621681144696"><span class="hs-identifier hs-var">scr_e</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DsM a
</span><a href="#local-6989586621681144697"><span class="hs-identifier hs-var">k</span></a></span><span>
</span><span id="line-1072"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#addScrutTmCs"><span class="hs-identifier hs-var">addScrutTmCs</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (LHsExpr (GhcPass 'Typechecked))
</span><span class="hs-identifier">_</span></span><span>   </span><span class="annot"><span class="annottext">[Id]
</span><span class="hs-identifier">_</span></span><span>   </span><span class="annot"><span class="annottext">DsM a
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; DsM a
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;addScrutTmCs: HsCase with more than one case binder&quot;</span></span><span>
</span><span id="line-1073"></span><span>
</span><span id="line-1074"></span><span class="hs-comment">{-
%************************************************************************
%*                                                                      *
      Pretty printing of exhaustiveness/redundancy check warnings
%*                                                                      *
%************************************************************************
-}</span><span>
</span><span id="line-1081"></span><span>
</span><span id="line-1082"></span><span class="hs-comment">-- | Check whether any part of pattern match checking is enabled for this</span><span>
</span><span id="line-1083"></span><span class="hs-comment">-- 'HsMatchContext' (does not matter whether it is the redundancy check or the</span><span>
</span><span id="line-1084"></span><span class="hs-comment">-- exhaustiveness check).</span><span>
</span><span id="line-1085"></span><span id="local-6989586621681145673"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#isMatchContextPmChecked"><span class="hs-identifier hs-type">isMatchContextPmChecked</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Origin"><span class="hs-identifier hs-type">Origin</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#HsMatchContext"><span class="hs-identifier hs-type">HsMatchContext</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681145673"><span class="hs-identifier hs-type">id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-1086"></span><span id="isMatchContextPmChecked"><span class="annot"><span class="annottext">isMatchContextPmChecked :: forall id. DynFlags -&gt; Origin -&gt; HsMatchContext id -&gt; Bool
</span><a href="GHC.HsToCore.PmCheck.html#isMatchContextPmChecked"><span class="hs-identifier hs-var hs-var">isMatchContextPmChecked</span></a></span></span><span> </span><span id="local-6989586621681144694"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144694"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681144693"><span class="annot"><span class="annottext">Origin
</span><a href="#local-6989586621681144693"><span class="hs-identifier hs-var">origin</span></a></span></span><span> </span><span id="local-6989586621681144692"><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="#local-6989586621681144692"><span class="hs-identifier hs-var">kind</span></a></span></span><span>
</span><span id="line-1087"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Origin -&gt; Bool
</span><a href="GHC.Types.Basic.html#isGenerated"><span class="hs-identifier hs-var">isGenerated</span></a></span><span> </span><span class="annot"><span class="annottext">Origin
</span><a href="#local-6989586621681144693"><span class="hs-identifier hs-var">origin</span></a></span><span>
</span><span id="line-1088"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1089"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1090"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#wopt"><span class="hs-identifier hs-var">wopt</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnOverlappingPatterns"><span class="hs-identifier hs-var">Opt_WarnOverlappingPatterns</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144694"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; HsMatchContext id -&gt; Bool
forall id. DynFlags -&gt; HsMatchContext id -&gt; Bool
</span><a href="GHC.HsToCore.PmCheck.html#exhaustive"><span class="hs-identifier hs-var">exhaustive</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144694"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="#local-6989586621681144692"><span class="hs-identifier hs-var">kind</span></a></span><span>
</span><span id="line-1091"></span><span>
</span><span id="line-1092"></span><span class="hs-comment">-- | Return True when any of the pattern match warnings ('allPmCheckWarnings')</span><span>
</span><span id="line-1093"></span><span class="hs-comment">-- are enabled, in which case we need to run the pattern match checker.</span><span>
</span><span id="line-1094"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#needToRunPmCheck"><span class="hs-identifier hs-type">needToRunPmCheck</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Origin"><span class="hs-identifier hs-type">Origin</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1095"></span><span id="needToRunPmCheck"><span class="annot"><span class="annottext">needToRunPmCheck :: DynFlags -&gt; Origin -&gt; Bool
</span><a href="GHC.HsToCore.PmCheck.html#needToRunPmCheck"><span class="hs-identifier hs-var hs-var">needToRunPmCheck</span></a></span></span><span> </span><span id="local-6989586621681144688"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144688"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681144687"><span class="annot"><span class="annottext">Origin
</span><a href="#local-6989586621681144687"><span class="hs-identifier hs-var">origin</span></a></span></span><span>
</span><span id="line-1096"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Origin -&gt; Bool
</span><a href="GHC.Types.Basic.html#isGenerated"><span class="hs-identifier hs-var">isGenerated</span></a></span><span> </span><span class="annot"><span class="annottext">Origin
</span><a href="#local-6989586621681144687"><span class="hs-identifier hs-var">origin</span></a></span><span>
</span><span id="line-1097"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1098"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1099"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[WarningFlag] -&gt; Bool
forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-var">notNull</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(WarningFlag -&gt; Bool) -&gt; [WarningFlag] -&gt; [WarningFlag]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#wopt"><span class="hs-operator hs-var">`wopt`</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144688"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[WarningFlag]
</span><a href="GHC.HsToCore.PmCheck.html#allPmCheckWarnings"><span class="hs-identifier hs-var">allPmCheckWarnings</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1100"></span><span>
</span><span id="line-1101"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#redundantAndInaccessibleRhss"><span class="hs-identifier hs-type">redundantAndInaccessibleRhss</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AnnotatedTree"><span class="hs-identifier hs-type">AnnotatedTree</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#RhsInfo"><span class="hs-identifier hs-type">RhsInfo</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#RhsInfo"><span class="hs-identifier hs-type">RhsInfo</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1102"></span><span id="redundantAndInaccessibleRhss"><span class="annot"><span class="annottext">redundantAndInaccessibleRhss :: AnnotatedTree -&gt; ([RhsInfo], [RhsInfo])
</span><a href="GHC.HsToCore.PmCheck.html#redundantAndInaccessibleRhss"><span class="hs-identifier hs-var hs-var">redundantAndInaccessibleRhss</span></a></span></span><span> </span><span id="local-6989586621681144683"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144683"><span class="hs-identifier hs-var">tree</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OrdList RhsInfo -&gt; [RhsInfo]
forall a. OrdList a -&gt; [a]
</span><a href="GHC.Data.OrdList.html#fromOL"><span class="hs-identifier hs-var">fromOL</span></a></span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo
</span><a href="#local-6989586621681144682"><span class="hs-identifier hs-var">ol_red</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo -&gt; [RhsInfo]
forall a. OrdList a -&gt; [a]
</span><a href="GHC.Data.OrdList.html#fromOL"><span class="hs-identifier hs-var">fromOL</span></a></span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo
</span><a href="#local-6989586621681144681"><span class="hs-identifier hs-var">ol_inacc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1103"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1104"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681144680"><span class="annot"><span class="annottext">OrdList RhsInfo
</span><a href="#local-6989586621681144680"><span class="hs-identifier hs-var">_ol_acc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144681"><span class="annot"><span class="annottext">OrdList RhsInfo
</span><a href="#local-6989586621681144681"><span class="hs-identifier hs-var">ol_inacc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144682"><span class="annot"><span class="annottext">OrdList RhsInfo
</span><a href="#local-6989586621681144682"><span class="hs-identifier hs-var">ol_red</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
-&gt; (OrdList RhsInfo, OrdList RhsInfo, OrdList RhsInfo)
</span><a href="#local-6989586621681144679"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144683"><span class="hs-identifier hs-var">tree</span></a></span><span>
</span><span id="line-1105"></span><span>    </span><span class="hs-comment">-- | Collects RHSs which are</span><span>
</span><span id="line-1106"></span><span>    </span><span class="hs-comment">--    1. accessible</span><span>
</span><span id="line-1107"></span><span>    </span><span class="hs-comment">--    2. proper inaccessible (so we can't delete them)</span><span>
</span><span id="line-1108"></span><span>    </span><span class="hs-comment">--    3. hypothetically redundant (so not only inaccessible RHS, but we can</span><span>
</span><span id="line-1109"></span><span>    </span><span class="hs-comment">--       even safely delete the equation without altering semantics)</span><span>
</span><span id="line-1110"></span><span>    </span><span class="hs-comment">-- See Note [Determining inaccessible clauses]</span><span>
</span><span id="line-1111"></span><span>    </span><span class="annot"><a href="#local-6989586621681144679"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AnnotatedTree"><span class="hs-identifier hs-type">AnnotatedTree</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Data.OrdList.html#OrdList"><span class="hs-identifier hs-type">OrdList</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#RhsInfo"><span class="hs-identifier hs-type">RhsInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.OrdList.html#OrdList"><span class="hs-identifier hs-type">OrdList</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#RhsInfo"><span class="hs-identifier hs-type">RhsInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.OrdList.html#OrdList"><span class="hs-identifier hs-type">OrdList</span></a></span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#RhsInfo"><span class="hs-identifier hs-type">RhsInfo</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1112"></span><span>    </span><span id="local-6989586621681144679"><span class="annot"><span class="annottext">go :: AnnotatedTree
-&gt; (OrdList RhsInfo, OrdList RhsInfo, OrdList RhsInfo)
</span><a href="#local-6989586621681144679"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#AccessibleRhs"><span class="hs-identifier hs-type">AccessibleRhs</span></a></span><span> </span><span class="annot"><span class="annottext">Deltas
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681144678"><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681144678"><span class="hs-identifier hs-var">info</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RhsInfo -&gt; OrdList RhsInfo
forall a. a -&gt; OrdList a
</span><a href="GHC.Data.OrdList.html#unitOL"><span class="hs-identifier hs-var">unitOL</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681144678"><span class="hs-identifier hs-var">info</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo
forall a. OrdList a
</span><a href="GHC.Data.OrdList.html#nilOL"><span class="hs-identifier hs-var">nilOL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo
forall a. OrdList a
</span><a href="GHC.Data.OrdList.html#nilOL"><span class="hs-identifier hs-var">nilOL</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1113"></span><span>    </span><span class="annot"><a href="#local-6989586621681144679"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#InaccessibleRhs"><span class="hs-identifier hs-type">InaccessibleRhs</span></a></span><span> </span><span id="local-6989586621681144677"><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681144677"><span class="hs-identifier hs-var">info</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OrdList RhsInfo
forall a. OrdList a
</span><a href="GHC.Data.OrdList.html#nilOL"><span class="hs-identifier hs-var">nilOL</span></a></span><span class="hs-special">,</span><span>       </span><span class="annot"><span class="annottext">OrdList RhsInfo
forall a. OrdList a
</span><a href="GHC.Data.OrdList.html#nilOL"><span class="hs-identifier hs-var">nilOL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RhsInfo -&gt; OrdList RhsInfo
forall a. a -&gt; OrdList a
</span><a href="GHC.Data.OrdList.html#unitOL"><span class="hs-identifier hs-var">unitOL</span></a></span><span> </span><span class="annot"><span class="annottext">RhsInfo
</span><a href="#local-6989586621681144677"><span class="hs-identifier hs-var">info</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- presumably redundant</span><span>
</span><span id="line-1114"></span><span>    </span><span class="annot"><a href="#local-6989586621681144679"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#MayDiverge"><span class="hs-identifier hs-type">MayDiverge</span></a></span><span> </span><span id="local-6989586621681144676"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144676"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-special">)</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
-&gt; (OrdList RhsInfo, OrdList RhsInfo, OrdList RhsInfo)
</span><a href="#local-6989586621681144679"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144676"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1115"></span><span>      </span><span class="hs-comment">-- See Note [Determining inaccessible clauses]</span><span>
</span><span id="line-1116"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621681144675"><span class="annot"><span class="annottext">OrdList RhsInfo
</span><a href="#local-6989586621681144675"><span class="hs-identifier hs-var">acc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144674"><span class="annot"><span class="annottext">OrdList RhsInfo
</span><a href="#local-6989586621681144674"><span class="hs-identifier hs-var">inacc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144673"><span class="annot"><span class="annottext">OrdList RhsInfo
</span><a href="#local-6989586621681144673"><span class="hs-identifier hs-var">red</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1117"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo -&gt; Bool
forall a. OrdList a -&gt; Bool
</span><a href="GHC.Data.OrdList.html#isNilOL"><span class="hs-identifier hs-var">isNilOL</span></a></span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo
</span><a href="#local-6989586621681144675"><span class="hs-identifier hs-var">acc</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo -&gt; Bool
forall a. OrdList a -&gt; Bool
</span><a href="GHC.Data.OrdList.html#isNilOL"><span class="hs-identifier hs-var">isNilOL</span></a></span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo
</span><a href="#local-6989586621681144674"><span class="hs-identifier hs-var">inacc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OrdList RhsInfo
forall a. OrdList a
</span><a href="GHC.Data.OrdList.html#nilOL"><span class="hs-identifier hs-var">nilOL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo
</span><a href="#local-6989586621681144673"><span class="hs-identifier hs-var">red</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo
forall a. OrdList a
</span><a href="GHC.Data.OrdList.html#nilOL"><span class="hs-identifier hs-var">nilOL</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1118"></span><span>      </span><span id="local-6989586621681144670"><span class="annot"><span class="annottext">(OrdList RhsInfo, OrdList RhsInfo, OrdList RhsInfo)
</span><a href="#local-6989586621681144670"><span class="hs-identifier hs-var">res</span></a></span></span><span>                              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(OrdList RhsInfo, OrdList RhsInfo, OrdList RhsInfo)
</span><a href="#local-6989586621681144670"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1119"></span><span>    </span><span class="annot"><a href="#local-6989586621681144679"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#SequenceAnn"><span class="hs-identifier hs-type">SequenceAnn</span></a></span><span> </span><span id="local-6989586621681144669"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144669"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681144668"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144668"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
-&gt; (OrdList RhsInfo, OrdList RhsInfo, OrdList RhsInfo)
</span><a href="#local-6989586621681144679"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144669"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">(OrdList RhsInfo, OrdList RhsInfo, OrdList RhsInfo)
-&gt; (OrdList RhsInfo, OrdList RhsInfo, OrdList RhsInfo)
-&gt; (OrdList RhsInfo, OrdList RhsInfo, OrdList RhsInfo)
forall a. Semigroup a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#%3C%3E"><span class="hs-operator hs-var">Semi.&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
-&gt; (OrdList RhsInfo, OrdList RhsInfo, OrdList RhsInfo)
</span><a href="#local-6989586621681144679"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144668"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1120"></span><span>    </span><span class="annot"><a href="#local-6989586621681144679"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#EmptyAnn"><span class="hs-identifier hs-var">EmptyAnn</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OrdList RhsInfo
forall a. OrdList a
</span><a href="GHC.Data.OrdList.html#nilOL"><span class="hs-identifier hs-var">nilOL</span></a></span><span class="hs-special">,</span><span>       </span><span class="annot"><span class="annottext">OrdList RhsInfo
forall a. OrdList a
</span><a href="GHC.Data.OrdList.html#nilOL"><span class="hs-identifier hs-var">nilOL</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">OrdList RhsInfo
forall a. OrdList a
</span><a href="GHC.Data.OrdList.html#nilOL"><span class="hs-identifier hs-var">nilOL</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1121"></span><span>
</span><span id="line-1122"></span><span class="hs-comment">{- Note [Determining inaccessible clauses]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
  f _  True = ()
  f () True = ()
  f _  _    = ()
Is f's second clause redundant? The perhaps surprising answer is, no, it isn't!
@f (error &quot;boom&quot;) False@ will force the error with clause 2, but will return
() if it was deleted, so clearly not redundant. Yet for now combination of
arguments we can ever reach clause 2's RHS, so we say it has inaccessible RHS
(as opposed to being completely redundant).

We detect an inaccessible RHS simply by pretending it's redundant, until we see
that it's part of a sub-tree in the pattern match that forces some argument
(which corresponds to wrapping the 'AnnotatedTree' in 'MayDiverge'). Then we
turn all supposedly redundant RHSs into inaccessible ones.

But as it turns out (@g@ from #17465) this is too conservative:
  g () | False = ()
       | otherwise = ()
g's first clause has an inaccessible RHS, but it's also safe to delete. So it's
redundant, really! But by just turning all redundant child clauses into
inaccessible ones, we report the first clause as inaccessible.

Clearly, it is enough if we say that we only degrade if *not all* of the child
clauses are redundant. As long as there is at least one clause which we announce
not to be redundant, the guard prefix responsible for the 'MayDiverge' will
survive. Hence we check for that in 'redundantAndInaccessibleRhss'.
-}</span><span>
</span><span id="line-1151"></span><span>
</span><span id="line-1152"></span><span class="hs-comment">-- | Issue all the warnings (coverage, exhaustiveness, inaccessibility)</span><span>
</span><span id="line-1153"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#dsPmWarn"><span class="hs-identifier hs-type">dsPmWarn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-type">DsMatchContext</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1154"></span><span id="dsPmWarn"><span class="annot"><span class="annottext">dsPmWarn :: DynFlags -&gt; DsMatchContext -&gt; [Id] -&gt; CheckResult -&gt; DsM ()
</span><a href="GHC.HsToCore.PmCheck.html#dsPmWarn"><span class="hs-identifier hs-var hs-var">dsPmWarn</span></a></span></span><span> </span><span id="local-6989586621681144667"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144667"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681144666"><span class="annot"><span class="annottext">ctx :: DsMatchContext
</span><a href="#local-6989586621681144666"><span class="hs-identifier hs-var">ctx</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-type">DsMatchContext</span></a></span><span> </span><span id="local-6989586621681144665"><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681144665"><span class="hs-identifier hs-var">kind</span></a></span></span><span> </span><span id="local-6989586621681144664"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144664"><span class="hs-identifier hs-var">loc</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144663"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144663"><span class="hs-identifier hs-var">vars</span></a></span></span><span> </span><span id="local-6989586621681144662"><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681144662"><span class="hs-identifier hs-var">result</span></a></span></span><span>
</span><span id="line-1155"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; DsM () -&gt; DsM ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144661"><span class="hs-identifier hs-var">flag_i</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144660"><span class="hs-identifier hs-var">flag_u</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(DsM () -&gt; DsM ()) -&gt; DsM () -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1156"></span><span>      </span><span id="local-6989586621681144659"><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144659"><span class="hs-identifier hs-var">unc_examples</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; Int -&gt; Deltas -&gt; DsM [Delta]
</span><a href="GHC.HsToCore.PmCheck.html#getNFirstUncovered"><span class="hs-identifier hs-var">getNFirstUncovered</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144663"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144657"><span class="hs-identifier hs-var">maxPatterns</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144655"><span class="hs-identifier hs-var">uncovered</span></a></span><span>
</span><span id="line-1157"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144654"><span class="annot"><span class="annottext">exists_r :: Bool
</span><a href="#local-6989586621681144654"><span class="hs-identifier hs-var hs-var">exists_r</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144661"><span class="hs-identifier hs-var">flag_i</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[RhsInfo] -&gt; Bool
forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-var">notNull</span></a></span><span> </span><span class="annot"><span class="annottext">[RhsInfo]
</span><a href="#local-6989586621681144653"><span class="hs-identifier hs-var">redundant</span></a></span><span>
</span><span id="line-1158"></span><span>          </span><span id="local-6989586621681144652"><span class="annot"><span class="annottext">exists_i :: Bool
</span><a href="#local-6989586621681144652"><span class="hs-identifier hs-var hs-var">exists_i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144661"><span class="hs-identifier hs-var">flag_i</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[RhsInfo] -&gt; Bool
forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-var">notNull</span></a></span><span> </span><span class="annot"><span class="annottext">[RhsInfo]
</span><a href="#local-6989586621681144651"><span class="hs-identifier hs-var">inaccessible</span></a></span><span>
</span><span id="line-1159"></span><span>          </span><span id="local-6989586621681144650"><span class="annot"><span class="annottext">exists_u :: Bool
</span><a href="#local-6989586621681144650"><span class="hs-identifier hs-var hs-var">exists_u</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144660"><span class="hs-identifier hs-var">flag_u</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[Delta] -&gt; Bool
forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-var">notNull</span></a></span><span> </span><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144659"><span class="hs-identifier hs-var">unc_examples</span></a></span><span>
</span><span id="line-1160"></span><span>          </span><span id="local-6989586621681144649"><span class="annot"><span class="annottext">approx :: Bool
</span><a href="#local-6989586621681144649"><span class="hs-identifier hs-var hs-var">approx</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681144648"><span class="hs-identifier hs-var">precision</span></a></span><span> </span><span class="annot"><span class="annottext">Precision -&gt; Precision -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Precision
</span><a href="GHC.HsToCore.PmCheck.html#Approximate"><span class="hs-identifier hs-var">Approximate</span></a></span><span>
</span><span id="line-1161"></span><span>
</span><span id="line-1162"></span><span>      </span><span class="annot"><span class="annottext">Bool -&gt; DsM () -&gt; DsM ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144649"><span class="hs-identifier hs-var">approx</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144650"><span class="hs-identifier hs-var">exists_u</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144652"><span class="hs-identifier hs-var">exists_i</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(DsM () -&gt; DsM ()) -&gt; DsM () -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1163"></span><span>        </span><span class="annot"><span class="annottext">SrcSpan -&gt; DsM () -&gt; DsM ()
forall a. SrcSpan -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#putSrcSpanDs"><span class="hs-identifier hs-var">putSrcSpanDs</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144664"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarnReason -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#warnDs"><span class="hs-identifier hs-var">warnDs</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason
</span><a href="GHC.Driver.Flags.html#NoReason"><span class="hs-identifier hs-var">NoReason</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144644"><span class="hs-identifier hs-var">approx_msg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1164"></span><span>
</span><span id="line-1165"></span><span>      </span><span class="annot"><span class="annottext">Bool -&gt; DsM () -&gt; DsM ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144654"><span class="hs-identifier hs-var">exists_r</span></a></span><span> </span><span class="annot"><span class="annottext">(DsM () -&gt; DsM ()) -&gt; DsM () -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[RhsInfo] -&gt; (RhsInfo -&gt; DsM ()) -&gt; DsM ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
t a -&gt; (a -&gt; m b) -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#forM_"><span class="hs-identifier hs-var">forM_</span></a></span><span> </span><span class="annot"><span class="annottext">[RhsInfo]
</span><a href="#local-6989586621681144653"><span class="hs-identifier hs-var">redundant</span></a></span><span> </span><span class="annot"><span class="annottext">((RhsInfo -&gt; DsM ()) -&gt; DsM ()) -&gt; (RhsInfo -&gt; DsM ()) -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681144643"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144643"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681144642"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144642"><span class="hs-identifier hs-var">q</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1166"></span><span>        </span><span class="annot"><span class="annottext">SrcSpan -&gt; DsM () -&gt; DsM ()
forall a. SrcSpan -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#putSrcSpanDs"><span class="hs-identifier hs-var">putSrcSpanDs</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144643"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarnReason -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#warnDs"><span class="hs-identifier hs-var">warnDs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnOverlappingPatterns"><span class="hs-identifier hs-var">Opt_WarnOverlappingPatterns</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1167"></span><span>                               </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; String -&gt; SDoc
</span><a href="#local-6989586621681144640"><span class="hs-identifier hs-var">pprEqn</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144642"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;is redundant&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1168"></span><span>      </span><span class="annot"><span class="annottext">Bool -&gt; DsM () -&gt; DsM ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144652"><span class="hs-identifier hs-var">exists_i</span></a></span><span> </span><span class="annot"><span class="annottext">(DsM () -&gt; DsM ()) -&gt; DsM () -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[RhsInfo] -&gt; (RhsInfo -&gt; DsM ()) -&gt; DsM ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
t a -&gt; (a -&gt; m b) -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#forM_"><span class="hs-identifier hs-var">forM_</span></a></span><span> </span><span class="annot"><span class="annottext">[RhsInfo]
</span><a href="#local-6989586621681144651"><span class="hs-identifier hs-var">inaccessible</span></a></span><span> </span><span class="annot"><span class="annottext">((RhsInfo -&gt; DsM ()) -&gt; DsM ()) -&gt; (RhsInfo -&gt; DsM ()) -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681144639"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144639"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621681144638"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144638"><span class="hs-identifier hs-var">q</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1169"></span><span>        </span><span class="annot"><span class="annottext">SrcSpan -&gt; DsM () -&gt; DsM ()
forall a. SrcSpan -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#putSrcSpanDs"><span class="hs-identifier hs-var">putSrcSpanDs</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144639"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarnReason -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#warnDs"><span class="hs-identifier hs-var">warnDs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnOverlappingPatterns"><span class="hs-identifier hs-var">Opt_WarnOverlappingPatterns</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1170"></span><span>                               </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; String -&gt; SDoc
</span><a href="#local-6989586621681144640"><span class="hs-identifier hs-var">pprEqn</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144638"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;has inaccessible right hand side&quot;</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1171"></span><span>
</span><span id="line-1172"></span><span>      </span><span class="annot"><span class="annottext">Bool -&gt; DsM () -&gt; DsM ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144650"><span class="hs-identifier hs-var">exists_u</span></a></span><span> </span><span class="annot"><span class="annottext">(DsM () -&gt; DsM ()) -&gt; DsM () -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; DsM () -&gt; DsM ()
forall a. SrcSpan -&gt; DsM a -&gt; DsM a
</span><a href="GHC.HsToCore.Monad.html#putSrcSpanDs"><span class="hs-identifier hs-var">putSrcSpanDs</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144664"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(DsM () -&gt; DsM ()) -&gt; DsM () -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason -&gt; SDoc -&gt; DsM ()
</span><a href="GHC.HsToCore.Monad.html#warnDs"><span class="hs-identifier hs-var">warnDs</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason
</span><a href="#local-6989586621681144637"><span class="hs-identifier hs-var">flag_u_reason</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; DsM ()) -&gt; SDoc -&gt; DsM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1173"></span><span>        </span><span class="annot"><span class="annottext">[Id] -&gt; [Delta] -&gt; SDoc
</span><a href="#local-6989586621681144636"><span class="hs-identifier hs-var">pprEqns</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144663"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144659"><span class="hs-identifier hs-var">unc_examples</span></a></span><span>
</span><span id="line-1174"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1175"></span><span>    </span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#CheckResult"><span class="hs-identifier hs-type">CheckResult</span></a></span><span>
</span><span id="line-1176"></span><span>      </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cr_clauses :: CheckResult -&gt; AnnotatedTree
</span><a href="GHC.HsToCore.PmCheck.html#cr_clauses"><span class="hs-identifier hs-var">cr_clauses</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681144635"><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144635"><span class="hs-identifier hs-var">clauses</span></a></span></span><span>
</span><span id="line-1177"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cr_uncov :: CheckResult -&gt; Deltas
</span><a href="GHC.HsToCore.PmCheck.html#cr_uncov"><span class="hs-identifier hs-var">cr_uncov</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681144655"><span class="annot"><span class="annottext">Deltas
</span><a href="#local-6989586621681144655"><span class="hs-identifier hs-var">uncovered</span></a></span></span><span>
</span><span id="line-1178"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">cr_approx :: CheckResult -&gt; Precision
</span><a href="GHC.HsToCore.PmCheck.html#cr_approx"><span class="hs-identifier hs-var">cr_approx</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681144648"><span class="annot"><span class="annottext">Precision
</span><a href="#local-6989586621681144648"><span class="hs-identifier hs-var">precision</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CheckResult
</span><a href="#local-6989586621681144662"><span class="hs-identifier hs-var">result</span></a></span><span>
</span><span id="line-1179"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681144653"><span class="annot"><span class="annottext">[RhsInfo]
</span><a href="#local-6989586621681144653"><span class="hs-identifier hs-var">redundant</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144651"><span class="annot"><span class="annottext">[RhsInfo]
</span><a href="#local-6989586621681144651"><span class="hs-identifier hs-var">inaccessible</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AnnotatedTree -&gt; ([RhsInfo], [RhsInfo])
</span><a href="GHC.HsToCore.PmCheck.html#redundantAndInaccessibleRhss"><span class="hs-identifier hs-var">redundantAndInaccessibleRhss</span></a></span><span> </span><span class="annot"><span class="annottext">AnnotatedTree
</span><a href="#local-6989586621681144635"><span class="hs-identifier hs-var">clauses</span></a></span><span>
</span><span id="line-1180"></span><span>
</span><span id="line-1181"></span><span>    </span><span id="local-6989586621681144661"><span class="annot"><span class="annottext">flag_i :: Bool
</span><a href="#local-6989586621681144661"><span class="hs-identifier hs-var hs-var">flag_i</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; HsMatchContext GhcRn -&gt; Bool
forall id. DynFlags -&gt; HsMatchContext id -&gt; Bool
</span><a href="GHC.HsToCore.PmCheck.html#overlapping"><span class="hs-identifier hs-var">overlapping</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144667"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681144665"><span class="hs-identifier hs-var">kind</span></a></span><span>
</span><span id="line-1182"></span><span>    </span><span id="local-6989586621681144660"><span class="annot"><span class="annottext">flag_u :: Bool
</span><a href="#local-6989586621681144660"><span class="hs-identifier hs-var hs-var">flag_u</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; HsMatchContext GhcRn -&gt; Bool
forall id. DynFlags -&gt; HsMatchContext id -&gt; Bool
</span><a href="GHC.HsToCore.PmCheck.html#exhaustive"><span class="hs-identifier hs-var">exhaustive</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144667"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681144665"><span class="hs-identifier hs-var">kind</span></a></span><span>
</span><span id="line-1183"></span><span>    </span><span id="local-6989586621681144637"><span class="annot"><span class="annottext">flag_u_reason :: WarnReason
</span><a href="#local-6989586621681144637"><span class="hs-identifier hs-var hs-var">flag_u_reason</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarnReason
-&gt; (WarningFlag -&gt; WarnReason) -&gt; Maybe WarningFlag -&gt; WarnReason
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">WarnReason
</span><a href="GHC.Driver.Flags.html#NoReason"><span class="hs-identifier hs-var">NoReason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsMatchContext GhcRn -&gt; Maybe WarningFlag
forall id. HsMatchContext id -&gt; Maybe WarningFlag
</span><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681144665"><span class="hs-identifier hs-var">kind</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1184"></span><span>
</span><span id="line-1185"></span><span>    </span><span id="local-6989586621681144657"><span class="annot"><span class="annottext">maxPatterns :: Int
</span><a href="#local-6989586621681144657"><span class="hs-identifier hs-var hs-var">maxPatterns</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Int
</span><a href="GHC.Driver.Session.html#maxUncoveredPatterns"><span class="hs-identifier hs-var hs-var">maxUncoveredPatterns</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144667"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1186"></span><span>
</span><span id="line-1187"></span><span>    </span><span class="hs-comment">-- Print a single clause (for redundant/with-inaccessible-rhs)</span><span>
</span><span id="line-1188"></span><span>    </span><span id="local-6989586621681144640"><span class="annot"><span class="annottext">pprEqn :: SDoc -&gt; String -&gt; SDoc
</span><a href="#local-6989586621681144640"><span class="hs-identifier hs-var hs-var">pprEqn</span></a></span></span><span> </span><span id="local-6989586621681144630"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144630"><span class="hs-identifier hs-var">q</span></a></span></span><span> </span><span id="local-6989586621681144629"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681144629"><span class="hs-identifier hs-var">txt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; DsMatchContext -&gt; SDoc -&gt; ((SDoc -&gt; SDoc) -&gt; SDoc) -&gt; SDoc
</span><a href="GHC.HsToCore.PmCheck.html#pprContext"><span class="hs-identifier hs-var">pprContext</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">DsMatchContext
</span><a href="#local-6989586621681144666"><span class="hs-identifier hs-var">ctx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681144629"><span class="hs-identifier hs-var">txt</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(((SDoc -&gt; SDoc) -&gt; SDoc) -&gt; SDoc)
-&gt; ((SDoc -&gt; SDoc) -&gt; SDoc) -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681144627"><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="#local-6989586621681144627"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1189"></span><span>      </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="#local-6989586621681144627"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144630"><span class="hs-identifier hs-var">q</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn -&gt; SDoc
forall p. HsMatchContext p -&gt; SDoc
</span><a href="GHC.Hs.Expr.html#matchSeparator"><span class="hs-identifier hs-var">matchSeparator</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681144665"><span class="hs-identifier hs-var">kind</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;...&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1190"></span><span>
</span><span id="line-1191"></span><span>    </span><span class="hs-comment">-- Print several clauses (for uncovered clauses)</span><span>
</span><span id="line-1192"></span><span>    </span><span id="local-6989586621681144636"><span class="annot"><span class="annottext">pprEqns :: [Id] -&gt; [Delta] -&gt; SDoc
</span><a href="#local-6989586621681144636"><span class="hs-identifier hs-var hs-var">pprEqns</span></a></span></span><span> </span><span id="local-6989586621681144625"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144625"><span class="hs-identifier hs-var">vars</span></a></span></span><span> </span><span id="local-6989586621681144624"><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144624"><span class="hs-identifier hs-var">deltas</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; DsMatchContext -&gt; SDoc -&gt; ((SDoc -&gt; SDoc) -&gt; SDoc) -&gt; SDoc
</span><a href="GHC.HsToCore.PmCheck.html#pprContext"><span class="hs-identifier hs-var">pprContext</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">DsMatchContext
</span><a href="#local-6989586621681144666"><span class="hs-identifier hs-var">ctx</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;are non-exhaustive&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(((SDoc -&gt; SDoc) -&gt; SDoc) -&gt; SDoc)
-&gt; ((SDoc -&gt; SDoc) -&gt; SDoc) -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1193"></span><span>      </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144625"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-comment">-- See #11245</span><span>
</span><span id="line-1194"></span><span>           </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Guards do not cover entire pattern space&quot;</span></span><span>
</span><span id="line-1195"></span><span>           </span><span class="annot"><span class="annottext">[Id]
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681144623"><span class="annot"><span class="annottext">us :: [SDoc]
</span><a href="#local-6989586621681144623"><span class="hs-identifier hs-var hs-var">us</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Delta -&gt; SDoc) -&gt; [Delta] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681144622"><span class="annot"><span class="annottext">Delta
</span><a href="#local-6989586621681144622"><span class="hs-identifier hs-var">delta</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Delta -&gt; [Id] -&gt; SDoc
</span><a href="GHC.HsToCore.PmCheck.Ppr.html#pprUncovered"><span class="hs-identifier hs-var">pprUncovered</span></a></span><span> </span><span class="annot"><span class="annottext">Delta
</span><a href="#local-6989586621681144622"><span class="hs-identifier hs-var">delta</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144625"><span class="hs-identifier hs-var">vars</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144624"><span class="hs-identifier hs-var">deltas</span></a></span><span>
</span><span id="line-1196"></span><span>                 </span><span class="hs-keyword">in</span><span>  </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Patterns not matched:&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span>
</span><span id="line-1197"></span><span>                       </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; [SDoc] -&gt; [SDoc]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144657"><span class="hs-identifier hs-var">maxPatterns</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc]
</span><a href="#local-6989586621681144623"><span class="hs-identifier hs-var">us</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; [SDoc] -&gt; SDoc
forall a. Int -&gt; [a] -&gt; SDoc
</span><a href="GHC.HsToCore.PmCheck.html#dots"><span class="hs-identifier hs-var">dots</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144657"><span class="hs-identifier hs-var">maxPatterns</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc]
</span><a href="#local-6989586621681144623"><span class="hs-identifier hs-var">us</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1198"></span><span>
</span><span id="line-1199"></span><span>    </span><span id="local-6989586621681144644"><span class="annot"><span class="annottext">approx_msg :: SDoc
</span><a href="#local-6989586621681144644"><span class="hs-identifier hs-var hs-var">approx_msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span>
</span><span id="line-1200"></span><span>      </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span>
</span><span id="line-1201"></span><span>          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Pattern match checker ran into -fmax-pmcheck-models=&quot;</span></span><span>
</span><span id="line-1202"></span><span>            </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#int"><span class="hs-identifier hs-var">int</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; Int
</span><a href="GHC.Driver.Session.html#maxPmCheckModels"><span class="hs-identifier hs-var hs-var">maxPmCheckModels</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144667"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1203"></span><span>            </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot; limit, so&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1204"></span><span>          </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span>
</span><span id="line-1205"></span><span>          </span><span class="hs-special">(</span><span>  </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#bullet"><span class="hs-identifier hs-var">bullet</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Redundant clauses might not be reported at all&quot;</span></span><span>
</span><span id="line-1206"></span><span>          </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#bullet"><span class="hs-identifier hs-var">bullet</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Redundant clauses might be reported as inaccessible&quot;</span></span><span>
</span><span id="line-1207"></span><span>          </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#bullet"><span class="hs-identifier hs-var">bullet</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Patterns reported as unmatched might actually be matched&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1208"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Increase the limit or resolve the warnings to suppress this message.&quot;</span></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1209"></span><span>
</span><span id="line-1210"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#getNFirstUncovered"><span class="hs-identifier hs-type">getNFirstUncovered</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Deltas"><span class="hs-identifier hs-type">Deltas</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#DsM"><span class="hs-identifier hs-type">DsM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#Delta"><span class="hs-identifier hs-type">Delta</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1211"></span><span id="getNFirstUncovered"><span class="annot"><span class="annottext">getNFirstUncovered :: [Id] -&gt; Int -&gt; Deltas -&gt; DsM [Delta]
</span><a href="GHC.HsToCore.PmCheck.html#getNFirstUncovered"><span class="hs-identifier hs-var hs-var">getNFirstUncovered</span></a></span></span><span> </span><span id="local-6989586621681144616"><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144616"><span class="hs-identifier hs-var">vars</span></a></span></span><span> </span><span id="local-6989586621681144615"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144615"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.PmCheck.Types.html#MkDeltas"><span class="hs-identifier hs-type">MkDeltas</span></a></span><span> </span><span id="local-6989586621681144614"><span class="annot"><span class="annottext">Bag Delta
</span><a href="#local-6989586621681144614"><span class="hs-identifier hs-var">deltas</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Delta] -&gt; DsM [Delta]
</span><a href="#local-6989586621681144613"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144615"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bag Delta -&gt; [Delta]
forall a. Bag a -&gt; [a]
</span><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier hs-var">bagToList</span></a></span><span> </span><span class="annot"><span class="annottext">Bag Delta
</span><a href="#local-6989586621681144614"><span class="hs-identifier hs-var">deltas</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1212"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1213"></span><span>    </span><span id="local-6989586621681144613"><span class="annot"><span class="annottext">go :: Int -&gt; [Delta] -&gt; DsM [Delta]
</span><a href="#local-6989586621681144613"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">[Delta]
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Delta] -&gt; DsM [Delta]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1214"></span><span>    </span><span class="annot"><a href="#local-6989586621681144613"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Delta] -&gt; DsM [Delta]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1215"></span><span>    </span><span class="annot"><a href="#local-6989586621681144613"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621681144611"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144611"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681144610"><span class="annot"><span class="annottext">Delta
</span><a href="#local-6989586621681144610"><span class="hs-identifier hs-var">delta</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681144609"><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144609"><span class="hs-identifier hs-var">deltas</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1216"></span><span>      </span><span id="local-6989586621681144608"><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144608"><span class="hs-identifier hs-var">front</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Id] -&gt; Int -&gt; Delta -&gt; DsM [Delta]
</span><a href="GHC.HsToCore.PmCheck.Oracle.html#provideEvidence"><span class="hs-identifier hs-var">provideEvidence</span></a></span><span> </span><span class="annot"><span class="annottext">[Id]
</span><a href="#local-6989586621681144616"><span class="hs-identifier hs-var">vars</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144611"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Delta
</span><a href="#local-6989586621681144610"><span class="hs-identifier hs-var">delta</span></a></span><span>
</span><span id="line-1217"></span><span>      </span><span id="local-6989586621681144606"><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144606"><span class="hs-identifier hs-var">back</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Delta] -&gt; DsM [Delta]
</span><a href="#local-6989586621681144613"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144611"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">[Delta] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144608"><span class="hs-identifier hs-var">front</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144609"><span class="hs-identifier hs-var">deltas</span></a></span><span>
</span><span id="line-1218"></span><span>      </span><span class="annot"><span class="annottext">[Delta] -&gt; DsM [Delta]
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144608"><span class="hs-identifier hs-var">front</span></a></span><span> </span><span class="annot"><span class="annottext">[Delta] -&gt; [Delta] -&gt; [Delta]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Delta]
</span><a href="#local-6989586621681144606"><span class="hs-identifier hs-var">back</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1219"></span><span>
</span><span id="line-1220"></span><span class="hs-comment">{- Note [Inaccessible warnings for record updates]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider (#12957)
  data T a where
    T1 :: { x :: Int } -&gt; T Bool
    T2 :: { x :: Int } -&gt; T a
    T3 :: T a

  f :: T Char -&gt; T a
  f r = r { x = 3 }

The desugarer will (conservatively generate a case for T1 even though
it's impossible:
  f r = case r of
          T1 x -&gt; T1 3   -- Inaccessible branch
          T2 x -&gt; T2 3
          _    -&gt; error &quot;Missing&quot;

We don't want to warn about the inaccessible branch because the programmer
didn't put it there!  So we filter out the warning here.

The same can happen for long distance term constraints instead of type
constraints (#17783):

  data T = A { x :: Int } | B { x :: Int }
  f r@A{} = r { x = 3 }
  f _     = B 0

Here, the long distance info from the FunRhs match (@r ~ A x@) will make the
clause matching on @B@ of the desugaring to @case@ redundant. It's generated
code that we don't want to warn about.
-}</span><span>
</span><span id="line-1252"></span><span>
</span><span id="line-1253"></span><span id="local-6989586621681145656"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#dots"><span class="hs-identifier hs-type">dots</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621681145656"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span></span><span>
</span><span id="line-1254"></span><span id="dots"><span class="annot"><span class="annottext">dots :: forall a. Int -&gt; [a] -&gt; SDoc
</span><a href="GHC.HsToCore.PmCheck.html#dots"><span class="hs-identifier hs-var hs-var">dots</span></a></span></span><span> </span><span id="local-6989586621681144605"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144605"><span class="hs-identifier hs-var">maxPatterns</span></a></span></span><span> </span><span id="local-6989586621681144604"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681144604"><span class="hs-identifier hs-var">qs</span></a></span></span><span>
</span><span id="line-1255"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621681144604"><span class="hs-identifier hs-var">qs</span></a></span><span> </span><span class="annot"><span class="annottext">[a] -&gt; Int -&gt; Bool
forall a. [a] -&gt; Int -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthExceeds"><span class="hs-operator hs-var">`lengthExceeds`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621681144605"><span class="hs-identifier hs-var">maxPatterns</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;...&quot;</span></span><span>
</span><span id="line-1256"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1257"></span><span>
</span><span id="line-1258"></span><span class="hs-comment">-- | All warning flags that need to run the pattern match checker.</span><span>
</span><span id="line-1259"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#allPmCheckWarnings"><span class="hs-identifier hs-type">allPmCheckWarnings</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Driver.Flags.html#WarningFlag"><span class="hs-identifier hs-type">WarningFlag</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1260"></span><span id="allPmCheckWarnings"><span class="annot"><span class="annottext">allPmCheckWarnings :: [WarningFlag]
</span><a href="GHC.HsToCore.PmCheck.html#allPmCheckWarnings"><span class="hs-identifier hs-var hs-var">allPmCheckWarnings</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1261"></span><span>  </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnIncompletePatterns"><span class="hs-identifier hs-var">Opt_WarnIncompletePatterns</span></a></span><span>
</span><span id="line-1262"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnIncompleteUniPatterns"><span class="hs-identifier hs-var">Opt_WarnIncompleteUniPatterns</span></a></span><span>
</span><span id="line-1263"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnIncompletePatternsRecUpd"><span class="hs-identifier hs-var">Opt_WarnIncompletePatternsRecUpd</span></a></span><span>
</span><span id="line-1264"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnOverlappingPatterns"><span class="hs-identifier hs-var">Opt_WarnOverlappingPatterns</span></a></span><span>
</span><span id="line-1265"></span><span>  </span><span class="hs-special">]</span><span>
</span><span id="line-1266"></span><span>
</span><span id="line-1267"></span><span class="hs-comment">-- | Check whether the redundancy checker should run (redundancy only)</span><span>
</span><span id="line-1268"></span><span id="local-6989586621681144599"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#overlapping"><span class="hs-identifier hs-type">overlapping</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#HsMatchContext"><span class="hs-identifier hs-type">HsMatchContext</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681144599"><span class="hs-identifier hs-type">id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-1269"></span><span class="hs-comment">-- See Note [Inaccessible warnings for record updates]</span><span>
</span><span id="line-1270"></span><span id="overlapping"><span class="annot"><span class="annottext">overlapping :: forall id. DynFlags -&gt; HsMatchContext id -&gt; Bool
</span><a href="GHC.HsToCore.PmCheck.html#overlapping"><span class="hs-identifier hs-var hs-var">overlapping</span></a></span></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><span class="hs-identifier">_</span></span><span>      </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="GHC.Hs.Expr.html#RecUpd"><span class="hs-identifier hs-var">RecUpd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1271"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#overlapping"><span class="hs-identifier hs-var">overlapping</span></a></span><span> </span><span id="local-6989586621681144597"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144597"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#wopt"><span class="hs-identifier hs-var">wopt</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnOverlappingPatterns"><span class="hs-identifier hs-var">Opt_WarnOverlappingPatterns</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144597"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1272"></span><span>
</span><span id="line-1273"></span><span class="hs-comment">-- | Check whether the exhaustiveness checker should run (exhaustiveness only)</span><span>
</span><span id="line-1274"></span><span id="local-6989586621681145827"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustive"><span class="hs-identifier hs-type">exhaustive</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#HsMatchContext"><span class="hs-identifier hs-type">HsMatchContext</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681145827"><span class="hs-identifier hs-type">id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span><span>
</span><span id="line-1275"></span><span id="exhaustive"><span class="annot"><span class="annottext">exhaustive :: forall id. DynFlags -&gt; HsMatchContext id -&gt; Bool
</span><a href="GHC.HsToCore.PmCheck.html#exhaustive"><span class="hs-identifier hs-var hs-var">exhaustive</span></a></span></span><span>  </span><span id="local-6989586621681144596"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144596"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; (WarningFlag -&gt; Bool) -&gt; Maybe WarningFlag -&gt; Bool
forall b a. b -&gt; (a -&gt; b) -&gt; Maybe a -&gt; b
</span><a href="../../base/src/Data.Maybe.html#maybe"><span class="hs-identifier hs-var">maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#wopt"><span class="hs-operator hs-var">`wopt`</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681144596"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(Maybe WarningFlag -&gt; Bool)
-&gt; (HsMatchContext id -&gt; Maybe WarningFlag)
-&gt; HsMatchContext id
-&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id -&gt; Maybe WarningFlag
forall id. HsMatchContext id -&gt; Maybe WarningFlag
</span><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span>
</span><span id="line-1276"></span><span>
</span><span id="line-1277"></span><span class="hs-comment">-- | Denotes whether an exhaustiveness check is supported, and if so,</span><span>
</span><span id="line-1278"></span><span class="hs-comment">-- via which 'WarningFlag' it's controlled.</span><span>
</span><span id="line-1279"></span><span class="hs-comment">-- Returns 'Nothing' if check is not supported.</span><span>
</span><span id="line-1280"></span><span id="local-6989586621681145658"><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-type">exhaustiveWarningFlag</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#HsMatchContext"><span class="hs-identifier hs-type">HsMatchContext</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681145658"><span class="hs-identifier hs-type">id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Driver.Flags.html#WarningFlag"><span class="hs-identifier hs-type">WarningFlag</span></a></span></span><span>
</span><span id="line-1281"></span><span id="exhaustiveWarningFlag"><span class="annot"><span class="annottext">exhaustiveWarningFlag :: forall id. HsMatchContext id -&gt; Maybe WarningFlag
</span><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var hs-var">exhaustiveWarningFlag</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#FunRhs"><span class="hs-identifier hs-type">FunRhs</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; Maybe WarningFlag
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnIncompletePatterns"><span class="hs-identifier hs-var">Opt_WarnIncompletePatterns</span></a></span><span>
</span><span id="line-1282"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="GHC.Hs.Expr.html#CaseAlt"><span class="hs-identifier hs-var">CaseAlt</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; Maybe WarningFlag
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnIncompletePatterns"><span class="hs-identifier hs-var">Opt_WarnIncompletePatterns</span></a></span><span>
</span><span id="line-1283"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="GHC.Hs.Expr.html#IfAlt"><span class="hs-identifier hs-var">IfAlt</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; Maybe WarningFlag
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnIncompletePatterns"><span class="hs-identifier hs-var">Opt_WarnIncompletePatterns</span></a></span><span>
</span><span id="line-1284"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="GHC.Hs.Expr.html#LambdaExpr"><span class="hs-identifier hs-var">LambdaExpr</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; Maybe WarningFlag
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnIncompleteUniPatterns"><span class="hs-identifier hs-var">Opt_WarnIncompleteUniPatterns</span></a></span><span>
</span><span id="line-1285"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="GHC.Hs.Expr.html#PatBindRhs"><span class="hs-identifier hs-var">PatBindRhs</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; Maybe WarningFlag
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnIncompleteUniPatterns"><span class="hs-identifier hs-var">Opt_WarnIncompleteUniPatterns</span></a></span><span>
</span><span id="line-1286"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="GHC.Hs.Expr.html#PatBindGuards"><span class="hs-identifier hs-var">PatBindGuards</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; Maybe WarningFlag
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnIncompletePatterns"><span class="hs-identifier hs-var">Opt_WarnIncompletePatterns</span></a></span><span>
</span><span id="line-1287"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="GHC.Hs.Expr.html#ProcExpr"><span class="hs-identifier hs-var">ProcExpr</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; Maybe WarningFlag
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnIncompleteUniPatterns"><span class="hs-identifier hs-var">Opt_WarnIncompleteUniPatterns</span></a></span><span>
</span><span id="line-1288"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="GHC.Hs.Expr.html#RecUpd"><span class="hs-identifier hs-var">RecUpd</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; Maybe WarningFlag
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnIncompletePatternsRecUpd"><span class="hs-identifier hs-var">Opt_WarnIncompletePatternsRecUpd</span></a></span><span>
</span><span id="line-1289"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="GHC.Hs.Expr.html#ThPatSplice"><span class="hs-identifier hs-var">ThPatSplice</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe WarningFlag
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1290"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="GHC.Hs.Expr.html#PatSyn"><span class="hs-identifier hs-var">PatSyn</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe WarningFlag
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1291"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext id
</span><a href="GHC.Hs.Expr.html#ThPatQuote"><span class="hs-identifier hs-var">ThPatQuote</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe WarningFlag
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1292"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#exhaustiveWarningFlag"><span class="hs-identifier hs-var">exhaustiveWarningFlag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#StmtCtxt"><span class="hs-identifier hs-type">StmtCtxt</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe WarningFlag
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-comment">-- Don't warn about incomplete patterns</span><span>
</span><span id="line-1293"></span><span>                                       </span><span class="hs-comment">-- in list comprehensions, pattern guards</span><span>
</span><span id="line-1294"></span><span>                                       </span><span class="hs-comment">-- etc. They are often *supposed* to be</span><span>
</span><span id="line-1295"></span><span>                                       </span><span class="hs-comment">-- incomplete</span><span>
</span><span id="line-1296"></span><span>
</span><span id="line-1297"></span><span class="hs-comment">-- True &lt;==&gt; singular</span><span>
</span><span id="line-1298"></span><span class="annot"><a href="GHC.HsToCore.PmCheck.html#pprContext"><span class="hs-identifier hs-type">pprContext</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-type">DsMatchContext</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1299"></span><span id="pprContext"><span class="annot"><span class="annottext">pprContext :: Bool -&gt; DsMatchContext -&gt; SDoc -&gt; ((SDoc -&gt; SDoc) -&gt; SDoc) -&gt; SDoc
</span><a href="GHC.HsToCore.PmCheck.html#pprContext"><span class="hs-identifier hs-var hs-var">pprContext</span></a></span></span><span> </span><span id="local-6989586621681144584"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144584"><span class="hs-identifier hs-var">singular</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.HsToCore.Monad.html#DsMatchContext"><span class="hs-identifier hs-type">DsMatchContext</span></a></span><span> </span><span id="local-6989586621681144583"><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681144583"><span class="hs-identifier hs-var">kind</span></a></span></span><span> </span><span id="local-6989586621681144582"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681144582"><span class="hs-identifier hs-var">_loc</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681144581"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144581"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span id="local-6989586621681144580"><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc
</span><a href="#local-6989586621681144580"><span class="hs-identifier hs-var">rest_of_msg_fun</span></a></span></span><span>
</span><span id="line-1300"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621681144579"><span class="hs-identifier hs-var">txt</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144581"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1301"></span><span>          </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#sep"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;In&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144578"><span class="hs-identifier hs-var">ppr_match</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">':'</span></span><span>
</span><span id="line-1302"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">4</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc
</span><a href="#local-6989586621681144580"><span class="hs-identifier hs-var">rest_of_msg_fun</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="#local-6989586621681144576"><span class="hs-identifier hs-var">pref</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-1303"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1304"></span><span>    </span><span id="local-6989586621681144579"><span class="annot"><span class="annottext">txt :: String
</span><a href="#local-6989586621681144579"><span class="hs-identifier hs-var hs-var">txt</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681144584"><span class="hs-identifier hs-var">singular</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Pattern match&quot;</span></span><span>
</span><span id="line-1305"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Pattern match(es)&quot;</span></span><span>
</span><span id="line-1306"></span><span>
</span><span id="line-1307"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681144578"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144578"><span class="hs-identifier hs-var">ppr_match</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681144576"><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="#local-6989586621681144576"><span class="hs-identifier hs-var">pref</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1308"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681144583"><span class="hs-identifier hs-var">kind</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1309"></span><span>             </span><span class="annot"><a href="GHC.Hs.Expr.html#FunRhs"><span class="hs-identifier hs-type">FunRhs</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mc_fun :: forall p. HsMatchContext p -&gt; LIdP p
</span><a href="GHC.Hs.Expr.html#mc_fun"><span class="hs-identifier hs-var">mc_fun</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681144574"><span class="annot"><span class="annottext">IdP GhcRn
</span><a href="#local-6989586621681144574"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1310"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsMatchContext GhcRn -&gt; SDoc
forall p. Outputable (IdP p) =&gt; HsMatchContext p -&gt; SDoc
</span><a href="GHC.Hs.Expr.html#pprMatchContext"><span class="hs-identifier hs-var">pprMatchContext</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681144583"><span class="hs-identifier hs-var">kind</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681144572"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144572"><span class="hs-identifier hs-var">pp</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP GhcRn
</span><a href="#local-6989586621681144574"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144572"><span class="hs-identifier hs-var">pp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1311"></span><span>             </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsMatchContext GhcRn -&gt; SDoc
forall p. Outputable (IdP p) =&gt; HsMatchContext p -&gt; SDoc
</span><a href="GHC.Hs.Expr.html#pprMatchContext"><span class="hs-identifier hs-var">pprMatchContext</span></a></span><span> </span><span class="annot"><span class="annottext">HsMatchContext GhcRn
</span><a href="#local-6989586621681144583"><span class="hs-identifier hs-var">kind</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681144571"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144571"><span class="hs-identifier hs-var">pp</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681144571"><span class="hs-identifier hs-var">pp</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1312"></span></pre></body></html>